前几天课设做个聊天系统,顺便实现了这个在程序外显示弹幕作为消息提示的功能,这里记录一下怎么搞。
目录
效果
思路
- 创建一个子窗口
- 将子窗口去掉窗口标题栏,设置背景透明
- 在里面放文本Text
- 设置定时器控制子窗口从左到右移动,移动到右边缘时销毁子窗口
实操
- 新建qml文件,这里示例 Barrage.qml
- 里面写入:
import QtQuick 2.3
import QtQuick.Controls 2.5
//窗口
ApplicationWindow {
id:root
property string str: "我的洛天依" //弹幕文本内容
width: 300
height: 40
flags: Qt.FramelessWindowHint //去掉窗口标题栏
color:"#00000000" //设置背景透明
Rectangle { //使用矩形包裹Text是为了在Text外面可以增加圆角矩形边框效果
anchors.fill: parent
border.width: 1 //设置边框
border.color: "#66ccff"
color:"#00000000"
radius: 20 //边框圆角
clip: true //超出矩形范围的内容隐藏
Text { //弹幕文本
anchors.fill: parent
text: str
font.bold: true
font.pointSize: 15
color: "#66ccff"
style: Text.Outline //设置文本样式,在字体轮廓加一层styleColor指定的颜色边缘,防止背景导致文本不明显
styleColor: "#fff"
horizontalAlignment: Text.AlignHCenter //居中
verticalAlignment: Text.AlignVCenter
clip: true
}
}
}
- 在需要调用的qml文件中,导入并按如下操作使用:
- 由于Barrage.qml和main.qml在同一目录下:
- 因此在main.qml中可以直接使用Barrage.qml
- 以下是 main.qml 的内容
import QtQuick
import QtQuick.Window 2.3
import QtQuick.Controls 2.5
Window {
id:mainWin
width: 700
height: 500
visible: true
title: qsTr("MimicryChat")
//添加弹幕
function addBarrage(in_str) {
var newCom = Qt.createComponent("Barrage.qml"); //创建弹幕窗口
var newWin = newCom.createObject();
newWin.x = 200;
newWin.y = Math.random() * 900; //随机竖直位置
newWin.str = in_str; //设置弹幕文本
newWin.show(); //显示弹幕窗口
//设置定时控制器
let timer = Qt.createQmlObject("import QtQuick 2.14; Timer {}", mainWin);
timer.interval = 20; //执行间隔时间(单位ms)
timer.repeat = true; //重复执行
timer.triggered.connect(function() { //执行内容
if(newWin.x < 1700) { //如果没到右边缘就移动2个像素点
newWin.x += 2;
} else {
timer.stop(); //到达右边缘,则停止定时控制器,并销毁弹幕
newWin.close();
}
});
timer.start(); //启动定时器
}
Rectangle { //主窗口背景颜色
anchors.fill: parent
color: "#dde8fc"
radius: 20
}
Button {
width:100
height: 40
text:"发送弹幕"
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
//水平居中
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
addBarrage("嘿嘿,我的洛天依");
}
}
}
问题
- 这个弹幕会被其他高层次的窗口遮挡,显然问题在于我们创建的窗口不是顶层窗口,这个后面再看看咋整。
how much is metformin 500 mg
generic synthroid 200 mcg
can you buy valtrex over the counter in canada
Рады приветствовать вас, коллеги!
К вам обращается компания СЕО продвижения XRumer LLC.
Мы видим, у вас достаточно молодой портал и ему требуется внешнее SEO продвижение. Мы предлагаем продвижение в поиске под ключ. Также у нас имеются недорогие и качественные инструменты для СЕОшников. У наших специалистов серьезный опыт в данной нише, в арсенале есть успешные кейсы – если интересует, предоставим по запросу.
Мы готовы предложить скидку 10% до конца месяца.
Что мы предлагаем:
– Трастовые ссылки (требуется любому сайту) – от 1,5 до 5000 рублей
– Трастовые безанкорные ссылки (2500 штук) (полезно для любых сайтов) – 3900 р
– Качественный прогон по 110 000 сайтам в зоне RU (очень полезно для сайта) – 2900 руб
– 150 постов Вконтакте про ваш сайт (поможет получить рекламу) – 3900 рублей
– Статьи про ваш сайт на 300 интернет-форумах (мощнейшая раскрутка вашего ресурса) – 29.000 р
– СуперПостинг – это прогон на 3 000 000 ресурсов (мегамощный прогон для ваших сайтов) – 39900 руб
– Рассылаем сообщения по сайтам через форму обратной связи – цена по договоренности, зависит от объема.
Если что-то не понятно, без сомнений обращайтесь, подскажем.
Telgrm: @xrumers
https://XRumer.cc/
Skype: Loves.Ltd
order valtrex online usa
cost for valtrex
https://canadaph24.pro/# prescription drugs canada buy online
azithromycin 250 mg price in india
PBN sites
We shall create a network of private blog network sites!
Advantages of our self-owned blog network:
We execute everything so GOOGLE DOES NOT realize that this A self-owned blog network!!!
1- We purchase domain names from different registrars
2- The leading site is hosted on a VPS hosting (VPS is rapid hosting)
3- The remaining sites are on distinct hostings
4- We designate a individual Google ID to each site with verification in Google Search Console.
5- We make websites on WP, we don’t utilise plugins with aided by which Trojans penetrate and through which pages on your websites are produced.
6- We don’t duplicate templates and employ only unique text and pictures
We refrain from work with website design; the client, if desired, can then edit the websites to suit his wishes
PBN sites
We’ll generate a structure of privately-owned blog network sites!
Advantages of our self-owned blog network:
WE DO everything so GOOGLE DOES NOT understand that this A PBN network!!!
1- We buy domains from various registrars
2- The principal site is hosted on a virtual private server (Virtual Private Server is rapid hosting)
3- The remaining sites are on separate hostings
4- We designate a separate Google profile to each site with verification in Search Console.
5- We create websites on WP, we do not utilize plugins with the help of which malware penetrate and through which pages on your websites are produced.
6- We refrain from repeat templates and utilize only exclusive text and pictures
We refrain from work with website design; the client, if desired, can then edit the websites to suit his wishes
zithromax medicine
Hello this is kind of of off topic but I was wondering if blogs use WYSIWYG
editors or if you have to manually code with HTML.
I’m starting a blog soon but have no coding know-how so I wanted to get advice from someone
with experience. Any help would be greatly appreciated!
Here is my web blog; Puff Wow
https://mexicoph24.life/# mexican border pharmacies shipping to usa
mtpolice.kr provides sports betting information, sports analysis, and sports
tips as a sports community.
PBN sites
We will build a structure of privately-owned blog network sites!
Advantages of our PBN network:
WE DO everything SO THAT Google DOES NOT realize THAT this is A private blog network!!!
1- We obtain domains from different registrars
2- The main site is hosted on a VPS server (Virtual Private Server is fast hosting)
3- The rest of the sites are on different hostings
4- We attribute a distinct Google account to each site with verification in Google Search Console.
5- We design websites on WP, we don’t employ plugins with aided by which Trojans penetrate and through which pages on your websites are produced.
6- We never reproduce templates and utilise only exclusive text and pictures
We never work with website design; the client, if wished, can then edit the websites to suit his wishes
does zetia cause weight gain
canadian pharmacy discount coupon
PBN sites
We’ll establish a web of self-owned blog network sites!
Pros of our PBN network:
We perform everything so Google doesn’t understand THAT THIS IS A private blog network!!!
1- We purchase web domains from various registrars
2- The primary site is hosted on a VPS hosting (Virtual Private Server is rapid hosting)
3- The rest of the sites are on distinct hostings
4- We attribute a unique Google account to each site with confirmation in Search Console.
5- We create websites on WordPress, we don’t employ plugins with aided by which Trojans penetrate and through which pages on your websites are established.
6- We never reiterate templates and utilise only unique text and pictures
We never work with website design; the client, if wanted, can then edit the websites to suit his wishes
Thank you great post. Hello Administ .国产线播放免费人成视频播放
zofran prescription cost
Здравствуйте!
купить аттестат школы
Желаю каждому пятерошных) оценок!
http://alter-energo.ru/topic2673.html?view=previous
купить диплом ссср
купить диплом о среднем специальном
где купить диплом
medication from mexico pharmacy: mexico pharmacy – mexican online pharmacies prescription drugs
PBN sites
We shall build a web of PBN sites!
Pros of our self-owned blog network:
We carry out everything SO THAT GOOGLE does not comprehend THAT this is A self-owned blog network!!!
1- We acquire domain names from various registrars
2- The main site is hosted on a virtual private server (VPS is rapid hosting)
3- The rest of the sites are on various hostings
4- We assign a distinct Google account to each site with confirmation in Search Console.
5- We design websites on WordPress, we don’t use plugins with assisted by which Trojans penetrate and through which pages on your websites are generated.
6- We refrain from reiterate templates and employ only distinct text and pictures
We never work with website design; the client, if wanted, can then edit the websites to suit his wishes
lisinopril 12.5 tablet
PBN sites
We will create a system of private blog network sites!
Advantages of our privately-owned blog network:
We perform everything so Google does not grasp THAT this A PBN network!!!
1- We acquire domains from different registrars
2- The leading site is hosted on a VPS server (VPS is high-speed hosting)
3- Additional sites are on separate hostings
4- We assign a unique Google profile to each site with confirmation in Search Console.
5- We design websites on WP, we do not use plugins with assisted by which Trojans penetrate and through which pages on your websites are created.
6- We do not reiterate templates and use only distinct text and pictures
We don’t work with website design; the client, if wanted, can then edit the websites to suit his wishes
http://casinvietnam.shop/# danh bai tr?c tuy?n
Привет, дорогой читатель!
купить диплом магистра
Желаю любому положительных отметок!
http://mybaltika.info/ru/blogs/587/7778/
купить диплом магистра
купить диплом института
купить аттестат школы
glucophage australia
http://casinvietnam.shop/# casino tr?c tuy?n uy tin
buy prednisone mexico
Aplikacja powstała jako projekt open source’owy i
służy jako pokaz możliwości oprogramowania wykorzystującego narzędzia do wykrywania twarzy za
pomocą wbudowanej w smartfon przedniej kamery.
http://casinvietnam.com/# casino tr?c tuy?n vi?t nam
Доброго всем дня!
купить диплом в Москве
Желаю любому пятерошных) отметок!
https://tostadofoods.com/%D0%BA%D1%83%D0%BF%D0%B8%D1%82%D1%8C-%D0%B4%D0%B8%D0%BF%D0%BB%D0%BE%D0%BC-%D0%BE-%D0%B2%D1%8B%D1%81%D1%88%D0%B5%D0%BC-%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B8-%D0%BA%D1%83/
купить диплом о высшем образовании
купить диплом магистра
купить диплом о среднем специальном
canadian pharmacy without prescription
zyprexa cost walmart
wellbutrin for cessation of smoking
http://casinvietnam.com/# casino tr?c tuy?n vi?t nam
http://casinvietnam.shop/# danh bai tr?c tuy?n
I strongly recommend steer clear of this platform. My own encounter with it has been purely disappointment as well as doubts about scamming practices. Proceed with extreme caution, or better yet, seek out a trustworthy service to meet your needs.
Сегодня, когда аттестат – это начало удачной карьеры в любом направлении, многие стараются найти максимально быстрый путь получения качественного образования. Факт наличия официального документа сложно переоценить. Ведь диплом открывает дверь перед каждым человеком, который хочет вступить в профессиональное сообщество или учиться в ВУЗе.
Предлагаем очень быстро получить этот важный документ. Вы сможете приобрести аттестат старого или нового образца, что будет удачным решением для человека, который не смог завершить образование, утратил документ или желает исправить плохие оценки. Аттестат изготавливается с особой тщательностью, вниманием ко всем элементам, чтобы в результате получился документ, полностью соответствующий оригиналу.
Преимущество подобного подхода заключается не только в том, что вы максимально быстро получите свой аттестат. Процесс организовывается комфортно, с нашей поддержкой. Начиная от выбора необходимого образца до консультации по заполнению персональной информации и доставки по России — все будет находиться под полным контролем опытных мастеров.
В итоге, всем, кто пытается найти оперативный способ получить требуемый документ, наша компания готова предложить отличное решение. Заказать аттестат – это значит избежать длительного обучения и сразу перейти к достижению личных целей, будь то поступление в ВУЗ или старт карьеры.
http://prema-attestats.ru/
I urge you stay away from this site. The experience I had with it was only disappointment as well as suspicion of deceptive behavior. Exercise extreme caution, or even better, look for an honest site to fulfill your requirements.
I strongly recommend steer clear of this site. The experience I had with it was only disappointment and suspicion of deceptive behavior. Be extremely cautious, or better yet, find a more reputable site to fulfill your requirements.
http://casinvietnam.com/# game c? b?c online uy tin
PBN sites
We build a structure of self-owned blog network sites!
Pros of our privately-owned blog network:
WE DO everything SO THAT GOOGLE DOES NOT realize that this is A privately-owned blog network!!!
1- We acquire domains from separate registrars
2- The main site is hosted on a VPS hosting (VPS is rapid hosting)
3- Other sites are on distinct hostings
4- We assign a distinct Google profile to each site with verification in Search Console.
5- We develop websites on WP, we don’t utilise plugins with assisted by which Trojans penetrate and through which pages on your websites are created.
6- We don’t repeat templates and utilize only unique text and pictures
We don’t work with website design; the client, if wanted, can then edit the websites to suit his wishes
https://arusak-attestats.ru/ – Купить аттестат о среднем – путь к вашему будущему. В данном сервисе вы сможете легко и оперативно заказать аттестат, обязательный для последующего получения образования или трудоустройства. Наши специалисты обеспечивают качество и конфиденциальность услуги. Приобретайте школьный аттестат у нас и откройте дополнительные варианты для того, чтобы своего карьерного развития и карьеры.
PBN sites
We shall create a structure of PBN sites!
Benefits of our privately-owned blog network:
We execute everything SO THAT google DOES NOT realize that THIS IS A self-owned blog network!!!
1- We purchase web domains from separate registrars
2- The main site is hosted on a virtual private server (VPS is fast hosting)
3- The rest of the sites are on distinct hostings
4- We attribute a separate Google profile to each site with confirmation in Search Console.
5- We make websites on WordPress, we do not use plugins with assistance from which malware penetrate and through which pages on your websites are created.
6- We don’t repeat templates and use only distinct text and pictures
We refrain from work with website design; the client, if desired, can then edit the websites to suit his wishes
synthroid mexico
https://casinvietnam.shop/# game c? b?c online uy tin
zithromax 4 pills
Купить аттестат за 9 – путь к твоему перспективам. На нашем портале все вы можете легко и быстро заказать свидетельство, необходимый для того, чтобы последующего получения образования или трудоустройства. Наши специалисты обеспечивают высокое качество и конфиденциальность услуги. Заказывайте школьный аттестат здесь и проявите новые перспективы для своего образования и трудоустройства.