HomeОбразованиеRelated VideosMore From: VoidRealms

C++ Qt 4 - Signals and Slots

1365 ratings | 259233 views
These videos are a bit outdated - I am in the process of replacing these with courses on Udemy.com Below are links for the courses I have finished so far. (I will be making much much more) Qt Core Beginners https://www.udemy.com/qt-core-for-beginners/?couponCode=YOUTUBE100K QT Core Intermediate https://www.udemy.com/qt-core-intermediate/?couponCode=YOUTUBE100K
Html code for embedding videos on your blog
Text Comments (114)
Jeny Thorium (2 months ago)
QT and CPP language is the best.
Rich Schupbach (2 months ago)
Love your channel. New subscriber. Thank you for posting this information. I have a question about SIGNAL and SLOT. For some reason the valueChanged and setValue parameters do not show up in intellisense. I can enter them manually and the program builds and executes correctly. Just wondering if you may know why they are not showing up??
vishvender singh (6 months ago)
Great tutorials.... Do you have something on QSerialport??
Toni Nikolaš (1 year ago)
the best tutorial i've ever seen
Rogelio Gloria (1 year ago)
I am using your method for stackable widget. However, it appears there is other factors involve. Please address this issue. Initialization works using the ui->stackedWidget->setCurrentIndex(0). However, the action menu keys don't change the page. Maybe the tabs widget works. Here is the code I am using: #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->stackedWidget->setCurrentIndex(0); connect(ui->actionInfo,SIGNAL(triggered(bool)), ui->stackedWidget,SLOT(setCurrentIndex(0))); connect(ui->action3D_View,SIGNAL(triggered(bool)), ui->stackedWidget,SLOT(setCurrentIndex(1))); } MainWindow::~MainWindow() { delete ui; }
onjoFilms (1 year ago)
You know, someone from India is doing the same tutorials as you on Udemy for $10 for the course. If I found yours I wouldn't have paid.
VoidRealms (1 year ago)
onjoFilms like the same video with their voice over?
Chaniabba Kim (1 year ago)
Your work is as deep as good and practical.
Вася Пупкин (1 year ago)
Ну вот отчего я не знаю британского =(((
Dexter André Osiander (2 years ago)
I noticed around 2:35 that the progress bar doesn't actually go to 100%. But it does go to 0%. Is that a design decision, or a bug?
redeem5 (2 years ago)
Is there any disadvantage to just connecting them via the UI/Form rather than coding it manually other than less control and possibly needing to code it anyways?
Thomas Williams (2 years ago)
Is there any chance of you doing a tutorial on the new qt5 signal format. I am finding it difficult to understand compared to the old version
Thomas Williams (2 years ago)
I would but I don't really like facebook, so I refuse to join. I am on the QT forum though. Thanks for a great tutorial anyway.
VoidRealms (2 years ago)
Thomas Williams Recomend you join the voidrealms Facebook group and ask in there. lots of members can help out.
Eduard Voicu (2 years ago)
I need a tutorial on how to connect a signal and a slot from different classes, say, the slot is in the mainwindow and the signal is in the child modal dialog.......
Dustin Faxon (2 years ago)
I had no programming skills of any kind.. before watching all your videos.. then I made my own program... I would like to thank you for taking the time to make them all... I was wondering if you know how to take the source files from 2 programs and make 1 program with it... I want to combine pcsx2 emulator with cheat engine... or at the very least I would like to have my program attach to the cheat engine memory or to the pcsx2 memory. I want my line edits when I click a button to change a value at an address in the emulator... let me know if you can help me out... my program I made is update Npc maker... my YouTube channel is under Dustin Faxon....
samacumen (2 years ago)
Lovely tutorial! Thanks!
Guillermo Yáñez (2 years ago)
Oh my god. You're awesome dude. Greetings from Mexico!
Skwisgaar Skwigelf (2 years ago)
Pretty well explained, there goes my like :)
Rex Galilae (2 years ago)
I'm glad you're actually showing us the design method instead of directly jumping into the coding part. To me, the syntax was always bizarre and seemed very artificial and felt too user-made for me to feel comfortable with. There's such a huge list of keywords that it's easy to forget everything and not be able to make heads or tails out of it. Not to mention how the fact that everything in the window from the buttons to the sliders are referenced using the 'ui' pointer is strange enough.
James McManus (1 year ago)
Those old engineers were writing some real garbage 30 years ago when they were in their prime. Everything was unstable and insecure by today's standards. But they did OK given the tools of the time.
Rex Galilae (2 years ago)
+Juan Garcia I'm pretty darn strong with my C++ basics. I've been learning it since 2-3 years. I'm just bad at memorising too many keywords and the Qt syntax doesn't seem to be as natural and organic as the regular C++. That's all I wanted to say. Plus, I personally also prefer the Design mode because it's easier to visualise stuff that way
Juan Garcia (2 years ago)
+Juan Garcia stable*
Juan Garcia (2 years ago)
you better get back to the basics then..this why older engineers say that systems would .most likely will be less unstable (if made by new programmers LIKE YOU) . I'm sure this guy can code this without using this framework
Vuyani Ngubo (3 years ago)
how can i make the slide-bar and progress-bar signal-slot disconnect on a click of a button?
Rex Galilae (3 years ago)
Dude what's wrong with your cursor xD
Rex Galilae (3 years ago)
Finally a tutorial that uses more of the excellent features Qt provides instead of using the code, which is unbearably hard to remember. You have a new subscriber in me :)
najeh mchirgui (3 years ago)
Thanks you so much
Tyler Heers (3 years ago)
Amazing tutorials! Thank you!
SmykuPyka (3 years ago)
Well, I always thought that programing in C++ will be too hard for me, but after Mirosław's Zelent tutorial and your, is getting much easyier :D
Magissimus (1 year ago)
Mirosław spoko gość!
Skyline (2 years ago)
Miroslaw zelent, polaczku, tez go ogladam XDDDD
Juan Garcia (2 years ago)
-_- lol ...
DoodleFox (3 years ago)
This series is great! I finally understand how to do things, and not just learning how to copy-paste examples!
Julian Chindanai (3 years ago)
I think connect is a function that derives from QObject, not a Macro.
sebaogal1 (1 year ago)
But connect() is not
Thomas Williams (2 years ago)
Q_OBJECT is a macro
Scipio Klausen (3 years ago)
The first time I understand something in c++ tutorials. Nice👌
qsdfqsdf (3 years ago)
tutorial #4 and there is still no real core code...
my2004rx8 (3 years ago)
Why would you write connect and disconnect? Is there an actual reason or are you just showing us that it is possible to disconnect. I was thinking you should just not connect in the first place if you are going to disconnect later.
Parth Sané (3 years ago)
+my2004rx8 I think he's showing that we can disconnect if we want to. No real purpose.
Khaled Kimboo (3 years ago)
it's so quiet. i can hear your clock ticking
Vinokanth Velu (3 years ago)
Awesome tutorials. Thanks bro
Code Isura (3 years ago)
say if i want to connect slider and progress bar with another relation. for instance like progress bar is the half of the slider. How?
Josh Hayashida (4 years ago)
It's so relaxing listening to this guy talk. I feel like going to sleep now.
Chaniabba Kim (1 year ago)
Hahaha, nasal sound sounds good and cozy. I agree with you.
Ibrahim Guler (4 years ago)
great lectures..thank you Brian!
Osvaldo Zavala Angulo (4 years ago)
Incredible tutorials, just super fast learning on the basics importances about QT
Mathieu Sawan (4 years ago)
Hey, did you cover, in one of your tutorials, if I run the program, how I can input a parameter in terminal for let's say a dial and it changes it in my QWidget app?? I'm really having trouble with this.
letboo1 (4 years ago)
Hi Bryan, I'm using Qt 5.4. When doing this tutorial I encountered a couple of error. 1) Undefined reference to MainWindow::on_horizontalSlider_actionTriggered(int). 2) Id returned 1 exit status. Can you help me check what is the problem? Thanks
Jeroen Oomkes (4 years ago)
Note that there is a new syntax for signals and slots in Qt5: Instead of: connect(ui->horizontalSlider, SIGNAL(valueChanged(int)),               ui->progressBar, SLOT(setValue(int))); You can now write:     connect(ui->horizontalSlider, &QSlider::valueChanged,                   ui->progressBar, &QProgressBar::setValue); Read for pros and cons: http://qt-project.org/wiki/New_Signal_Slot_Syntax
Alok Jain (1 year ago)
Jeroen Oomkes
TKIP AES (1 year ago)
note it made four years that the video was out by the time you wrote this
Jman Zx (3 years ago)
+Jeroen Oomkes Wonderful! Thanks a lot, appreciated! :)
memcpy (4 years ago)
Thx for the hint :)
Poney01234 (4 years ago)
Viktor Hartung (4 years ago)
Thank you very much for this video!
Chris Sparks (4 years ago)
Good tutorial.  It would be nice to see you have one class emit a signal and another consume it.  This example is within the same class.
Bardeen Lai (4 years ago)
Very helpful, thank you so much!
gigagames (4 years ago)
7:06 lets say, i will make a button that disconnects prograssbar how i do it ? (how i say the button, if you get clicked run function X ?)
Pure Doomium (4 years ago)
I just started those tutorials and your comment is pretty old so you might've figured it out long ago but if anyone else wants the answer that's how I did it - I went to .ui section, created a pushbutton > rightclick it >go to slot (clicked) and inside of that void just write your disconnect(blah,SIGNAL,blah,SLOT);
Impillion (4 years ago)
Good job buddy
maxx astral (4 years ago)
really useful tutorial on Qt.. really appreciate your efforts... could you upload tutorials thats more specific to the new Qt5 versions which might also help a lot of people.. Keep up the good work
Alexis Otaño (4 years ago)
Usign version 5 and still can figureout what is what.. Great video thanks for sharing! nice job!
Malte — (4 years ago)
Can i support you in some way? Maybe a paypal or flattr link? Your videos helped me a lot. Keep the good work up. :-)
Malte — (4 years ago)
Can i support you in some way? Maybe a paypal or flattr link? Your videos helped me a lot. Keep the good work up. :-)
pacman7654 (5 years ago)
Wow you make this seem so easy, thank you!
Nicholas Gonzalez (5 years ago)
Thank you very helpful!
udalil palala (5 years ago)
skripsi ane nih gans...
Where is created code for conenctions on UI?
Lemmonio (5 years ago)
great videos .. thank you!
Abdul Basit Mehrabi (5 years ago)
We can also connect it in main.cpp QSlider *slider = new Qslider(Qt::Horizontal); QProgressbar *progressbar = new QProgressbar; QObject::connect(slider, SIGNAL(ValueChanged(int)), progressbar, SLOT(SetValue(int))); I think this could be good practice of programming..
Gordon Miller (5 years ago)
just add this line of code ui->horizontalSlider->setMaximum(100); Qt is so nice for learning new stuff, I just typed ui->horizontalSlider-> then scrolled through the list of options, every seems pretty well named so you can just guess what everything does. I also found this: ui->progressBar->setValue(0); for defaulting the progress bars to zero.
david habich (5 years ago)
now can the slot of the first bar be the signal of the second?
Ztube111 (5 years ago)
Excellent! Q: Why does the progress bar only go up to 99%? Fix?
Username (5 years ago)
"progarmatically" I like how it sounds ... VoidRealms I can say surely you are not "VOID"
mdostay (5 years ago)
Been coming back to these vids since I started using Qt about a year ago - thanks so much for them. Quick question - Is there an easy way using signals and slots to make a non-blocking asynchronous connection when both QObjects are in the same thread? I've seen a few solutions, but the best of the lot was a QTimer hack, and using Qt::QueuedConnection won't work. Any ideas are appreciated -- thanks.
Tununias (5 years ago)
I'm used to C# so I'm still kind of confused. Hopefully it makes more sense if I keep watching your tutorials.
Fontenele NXT (5 years ago)
Awesome, but it would be even better if you could explain every single thing like "ui", what is that for? How do we know when to use it? Just some advice so it can get even better. Thanks for the tutorials.
1okolawol (5 years ago)
how do you define your own slot functions?
Nguyen Ngoc Phuc (6 years ago)
what happen with mouse ?
Neils Clemenson (6 years ago)
Thanks for taking the time to make these tutorials.
Kunal Parihar (6 years ago)
Kunal Parihar (6 years ago)
Great work man and now because of your tuts, I can surely say that Qt is "cute."
SneakerTamer (6 years ago)
Brian -- great job! I have a quick question -- what should I do to make progressBar_2 and progressBar be "opposites" of each other. That is, is the horizontal slider is at 35, progressBar is at 35, while progressBar_2 is at 65 (=100-35). I am able to initialize the values, but when I set SIGNAL(100-ValueChanged(int)) it gives me an error. How do I get progressBar_2 to get the appropriate int? Any help pointers is greatly appreciated!
Rostyslav Skrypnyk (6 years ago)
Thank you so much for your work. You did a great job here.
Lingeshvirin Moonsamy (6 years ago)
i think this has to be one of the most important chapters involving GUI based projects with Qt
HadBabits (6 years ago)
He's just starting out in this series. As a new programmer this is both helping me get used to coding in QT (i.e. doing things without the design program) and getting used to using objects.
美結美優 Miyu (6 years ago)
How in the world is this teaching anyone anything, i learned less than the crappy little textfinder tutorial on the official qt tutorials page... im sorry but anyone with half a brain could have figured all that out just by playing around with the program for 15 minutes..even without any programming experience at all
tculig (6 years ago)
Thank you Brian!
Daniel Oliveira (6 years ago)
Same here.
sfappetrupavelandrei (6 years ago)
I've got a question: what if I want to make a custom function as a slot in a GUI project? For your example, what if I want to do a custom function for the progress bar in case we slide the slider?
The X Stanmarshk (6 years ago)
could you make a game engine in qt?
Terry (6 years ago)
Thanks a lot, it is really helpful.
TheExceptionLMessi (6 years ago)
Thank you Brian ;) I love your tutorial.
adminos15 (6 years ago)
ok, good tutorials :). When i try to start exe file, its give me some error, "blablablab is missing from your computer!".Can you tell me what can be the reason?I am asking you because i want to send some apps to my friends.Thank you.
KJ McLaws (6 years ago)
Hey your mouse like mine, gets stuck on the re-size! Isn't it aggravating!
QThello (6 years ago)
Hi Brian I liked your video. But i am curious to know whether i can create a gui using signal and slot method in order to communicate with an instrument through RS232 connection. I would appreciate your help. I have been gone through some of your tutorial and i liked them. They are good and very clear. Thank you for uploading.
Marsc0met (7 years ago)
Nah, the horizontal slider is a player. It's signal'ing two progress bars AT THE SAME TIME.
FreeWareFrolics (7 years ago)
Slider doesn't take the progress bar to 100% - I wonder why?!...
RoFlurite (7 years ago)
Good tutorials!
Alex Tselegidis (7 years ago)
Thanks for the tutorials! :)
Gdtheking (7 years ago)
Great work mate ! All the tutorial series helped me a lot !
yanike (7 years ago)
Thank You :)
southpaw (7 years ago)
Thanks for the tutorial, 10/10!
LaTaye2 (7 years ago)
i keep getting the error message that the pushbutton is not in the library with i try coding please help
Kirill Merkushev (7 years ago)
Nice to hear your voice. Your english is pretty good for understanding by the noob in programming, speaking russian :)
Martin Censoredname (7 years ago)
i tried to disconnect progressBar if(ui->progressBar->value() >= 50) but it didn't work... how do i have to change my code to make it work
The Proletariat (7 years ago)
fix your cursor!!!!!
smmirzadeh (7 years ago)
@7337cod3r The ui is not created prior to calling setupUi(this). What it does is basically creating all the widgets in the ui (slider and progress bars here) so that you can call and modify them later. Before this function call, non of the widgets exist yet and so you cannot call the connect function !
ACBoredz (7 years ago)
Thanks for the tutorial!
RealSourceryd (8 years ago)
very nice video and powerful IDE ... thanks dear ...
b00n90 (8 years ago)
VoidRealms (8 years ago)
Errata (from offical Qt forums): 01:05 You must not select anything to successfully apply a layout to a toplevel widget! In fact, your layout does not make the widgets expand to fill the available space like they should, but you must resize the layout manually 03:22 Q_OBJECT macro has nothing to do with the fact you can use the connect method (it doesn’t “provide” it or so), and connect is not a macro but a method of the QObject class

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.