Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. connect
    Log in to post

    • UNSOLVED How can I insert a function in a switch case?
      QML and Qt Quick • signal connect function alias switch • • Mateus  

      1
      0
      Votes
      1
      Posts
      68
      Views

      No one has replied

    • UNSOLVED How can I make a connection between 2 qml objects in differents screens?
      QML and Qt Quick • qml signal connect connection • • Mateus  

      3
      0
      Votes
      3
      Posts
      90
      Views

      There are many ways to do this, one of is: Notifier{ id : notifierId rectColor: "yellowgreen" target: receiverId visible: true onNotify: receiverId.receiveInfo(param) } Receiver { id : receiverId rectColor: "dodgerblue" anchors.right: parent.right visible: right }
    • UNSOLVED How to send command by usb (connected to terminal ) C++ QT
      Tools • c++ connect usb commands • • RuWex  

      6
      0
      Votes
      6
      Posts
      161
      Views

      @RuWex Sorry, I mean https://doc.qt.io/qt-6/qserialport.html
    • SOLVED Sync of scrollbar values
      General and Desktop • qtableview connect qscrollbar • • firen  

      3
      0
      Votes
      3
      Posts
      150
      Views

      @mrjj Thank you. Yes with an own signal + slot for the switch it is working
    • SOLVED difference between connect functions
      General and Desktop • connect signals&slots • • Corvette653  

      7
      0
      Votes
      7
      Posts
      198
      Views

      @Corvette653 said in difference between connect functions: "There is no automatic disconnection when the 'receiver' is destroyed because it's a functor with no QObject." That refers to the 3 arguments version of connect. Take this example: connect(lineEdit,&QLineEdit::textChanged,[label](const QString& text){label->setText(text);}); if you call delete label; Qt can't know it should not execute the slot anymore and will crash when trying to call label->setText. As mentioned in the docs, in the following phrase, the solution is to add label as a context argument (connect(lineEdit,&QLineEdit::textChanged,label,[label](const QString& text){label->setText(text);});) so that Qt knows that when label is destroyed it should not execute the slot anymore
    • SOLVED Command like "Qtab Clicked Connect" that can call a function?
      General and Desktop • connect qtabwidget clicked • • msyasak  

      7
      0
      Votes
      7
      Posts
      504
      Views

      Thank you @JonB, "currentChanged.connect" is worked.
    • SOLVED Why does a functor slot must have exactly the same number of arguments as signal?
      General and Desktop • connect slots slot connect slot • • Xeonacid  

      5
      0
      Votes
      5
      Posts
      380
      Views

      @J-Hilk Thanks! Hope it can be fixed soon. @jsulm Same thanks!
    • UNSOLVED Is it possible to use a tuple and a loop for QObject::connect?
      General and Desktop • connect organization • • Sailanarmo  

      5
      0
      Votes
      5
      Posts
      476
      Views

      See also https://doc.qt.io/qt-5/signalsandslots-syntaxes.html for a comparison between the old and new connect() syntaxes.
    • SOLVED Error when connecting a custom class and MainWindow
      General and Desktop • connect slots class signals connect problem • • Forfunckle  

      4
      0
      Votes
      4
      Posts
      402
      Views

      The problem was that my class inherited QGraphicsItem, not QObject, but I found another way to do what I wanted. From now on, I will use the new syntax. Thank you!
    • UNSOLVED How to connect to a slot with multiple arguments
      General and Desktop • signal & slot connect slot signalmapper • • hobbyProgrammer  

      13
      0
      Votes
      13
      Posts
      3792
      Views

      Hi, Where do you get that ID ? You'll click on the action, get the ID and then call the slot ?
    • UNSOLVED QObject::connect: Cannot connect (null)::pressed to MainWindow::handleExecutionButton()
      General and Desktop • c++ connect push button • • barzaka12  

      2
      0
      Votes
      2
      Posts
      563
      Views

      Hi, What is that ??? Ui_MainWindow *form = new Ui_MainWindow(); try: connect(ui->startButton, SIGNAL (pressed()), SLOT (handleExecutionButton()));
    • UNSOLVED QMessageBox closes application
      General and Desktop • connect mousepressevent qpolygon • • hobbyProgrammer  

      35
      0
      Votes
      35
      Posts
      1780
      Views

      @hobbyProgrammer said in window closes after completing certain actions.: @JonB Hi, just a quick update. I think it does get there, but it prints this part before going executing the slot. It's really important for those who try to help you to give accurate description of what does/does not happen. Everyone was trying to figure how your connect() could not complete and get to the next line....
    • UNSOLVED QObject::connect: Cannot queue arguments of type 'QTextCursor'
      General and Desktop • qtextedit connect multithreading qtextcursor process • • bachir  

      16
      0
      Votes
      16
      Posts
      13886
      Views

      @kshegunov Right... Thanks, something didnt trigger in the brain. Now its fine: connect(uap, &CUaProxy::uaItemChanged, this, [this, i]( const CUaProxy::MsgType msgt, const int riskIndex, const QVariant& value) { this->onUaMsgReceived(msgt, i, riskIndex, value); }, Qt::QueuedConnection); Also needed Qt::QueuedConnection eventually.
    • SOLVED Connecting two sliders manually?
      General and Desktop • connect qslider • • lansing  

      20
      0
      Votes
      20
      Posts
      2443
      Views

      @lansing Pro Tip. ;) If you right click your custom class name You can easy see and insert functions from base
    • UNSOLVED Can't connect to remote MySQL instance
      General and Desktop • mysql connect remote qt5.10 lost connection • • ChrisVT  

      14
      0
      Votes
      14
      Posts
      3515
      Views

      I may have misunderstood the case that doesn’t work. Can you maybe do a small picture with the setup ?
    • SOLVED New class --> signal and slots
      General and Desktop • signal & slot connect • • TMJJ  

      7
      0
      Votes
      7
      Posts
      1328
      Views

      @TMJJ I hope you are not going to interpret the output of candump in your application to receive CAN frames! SocketCAN provides a userspace API which can be perfectly used from C/C++ programs. As SocketCAN is open source, there are lots of examples how to do this, like the SocketCAN plugin of QtSerialBus or the source code of candump. Regards
    • SOLVED toggle QLineSeries visibility with QPushButton & connect?
      General and Desktop • connect visibility qlineseries toggle • • pauledd  

      3
      0
      Votes
      3
      Posts
      1011
      Views

      great! That works. With that I can spare the toggle functions at all. Thanks!
    • SOLVED How to connect a bool flag with a widget enable bool
      General and Desktop • connect flag • • vasu_gupta  

      7
      0
      Votes
      7
      Posts
      2634
      Views

      as it already suggested by other in the group, please go through signals/slots. Try few examples with how signals/slots work. This should give good info to achieve your use case.
    • UNSOLVED Connect() uses wrong emitter object.
      General and Desktop • signal connect slot class connection • • Kalado  

      7
      0
      Votes
      7
      Posts
      1825
      Views

      @Kalado said in Connect() uses wrong emitter object.: Look at some code: //A.h class task2 : public QWidget { Q_OBJECT public: task2(QWidget *parent = 0); ~task2(); protected: void mousePressEvent(QMouseEvent *event) override; signals: void myWidgetClicked(); //A.cpp void A::mousePressEvent(QMouseEvent *event){ /// use the respective classname emit myWidgetClicked(); } If ur using Classname as task2 , use void task2::mousePressEvent(QMouseEvent *event){ emit myWidgetClicked(); } Thanks,
    • SOLVED QObect::connect call does not compile
      General and Desktop • qobject connect socket tcpsocket • • CynaCons  

      5
      0
      Votes
      5
      Posts
      3892
      Views

      Adding the QObject constructor to my class's constructor and adding the pointer-to-member syntax suggested by Kshegunov fixed the issue. Thanks guys and good day.
    • SOLVED Pop up a new window on a pushed button
      General and Desktop • button window connect slots • • Adrian.Aioanei  

      6
      0
      Votes
      6
      Posts
      38543
      Views

      Yep, it works. Thanks :)
    • UNSOLVED Connect slider and line edit??
      General and Desktop • qlineedit connect qslider shared value • • QT-static-prgm  

      11
      0
      Votes
      11
      Posts
      7124
      Views

      But why use QLineEdit if you are only manipulating numbers ? That makes the code uselessly complicated.
    • SOLVED Signal/Slot unresolved overloaded function type QSpinBox
      General and Desktop • error signal & slot connect qspinbox overloaded • • pauledd  

      7
      0
      Votes
      7
      Posts
      5200
      Views

      Oh well, I see http://doc.qt.io/qt-5/qspinbox.html Signals void valueChanged(int i) void valueChanged(const QString &text) <--rtfm! Its now clear to me :)
    • UNSOLVED new Signal/Slot syntax with parent QWidget?
      General and Desktop • signal & slot connect parent syntax • • pauledd  

      10
      0
      Votes
      10
      Posts
      4183
      Views

      thanks for the enlightening!
    • UNSOLVED About Qt::DirectConnection
      General and Desktop • thread connect movetothread • • diverger  

      7
      0
      Votes
      7
      Posts
      5315
      Views

      @diverger As @micland already explained this does not have anything to do with Qt. It is a general problem with multi-threading: if you call a method from an object which leaves in another thread then you have to make sure this does not cause any problems.
    • UNSOLVED QTcpSokcet connected() signal not fired
      General and Desktop • signal connect slot qtcpsoket • • diverger  

      8
      0
      Votes
      8
      Posts
      3657
      Views

      @jsulm Thanks, I'll give it a try.
    • UNSOLVED Refreshing table as the items are set
      General and Desktop • connect table • • Lobstw  

      6
      0
      Votes
      6
      Posts
      1609
      Views

      You don't need multiple timers, just one that's not single shot and that you stop once all rows have been filled
    • UNSOLVED Scope of objects sent in connect statements
      General and Desktop • connect signal&slot scope • • RDiGuida  

      2
      0
      Votes
      2
      Posts
      996
      Views

      hi " When a signal is emitted, the slots connected to it are usually executed immediately, just like a normal function call. When this happens, the signals and slots mechanism is totally independent of any GUI event loop. Execution of the code following the emit statement will occur once all slots have returned. The situation is slightly different when using queued connections; in such a case, the code following the emit keyword will continue immediately, and the slots will be executed later." http://doc.qt.io/qt-5.5/signalsandslots.html
    • UNSOLVED qtconnectiontype
      General and Desktop • qmediaplayer connect queuedconnectio • • Lorence  

      4
      0
      Votes
      4
      Posts
      1579
      Views

      @Lorence When a signal is emitted that is connected to a slot through a queued connection, the actual invocation is deferred - an event is put into the event queue that belongs to the thread the receiver object lives in for later processing. This is why when you have a multithreaded application the slot is executed in the thread where the receiver lives in, and not in the thread where the actual signal was emitted. Here in the documentation is a more complete discussion.
    • connecting string item of qlistwidget to my class
      General and Desktop • qlistwidget connect item qt5.5.0 • • Lorence  

      2
      0
      Votes
      2
      Posts
      1362
      Views

      @Lorence said: Hi when you add "xxxx" to a qlistwidget you are adding a QListWidgetItem. While you can subclass QListWidgetItem and make your own that has signals, it would not do you so much good as it would never never emit such signal unless you also made it do so when something happen to it. (overriding some of its functions) So It all depends what you are trying to do. If you just want to know its no 1,2,3 etc, even if moved then you can insert that info into the QListWidgetItem using the void QListWidgetItem::setData(int role, const QVariant & value) something like QListWidgetItem * item=new QListWidgetItem("item1") ; item->setData(Qt::UserRole, 1); // or 2 for item 2 etc list->addItem(item) then you can always know which is which even if rearranged. see here for how to take index out also http://stackoverflow.com/questions/7136818/can-i-store-some-user-data-in-every-item-of-a-qlistwidget
    • UNSOLVED QObject::connect()
      General and Desktop • qobject connect qt5.5.0 connect failure • • Lorence  

      6
      0
      Votes
      6
      Posts
      2824
      Views

      @TheBadger I tried to investigate the error, and i found where it is coming from its from this line playList.emplace_back(ui->song->text().toStdString()); which is written before the connect() in the code
    • SOLVED Need a little help with QPushButton & connect
      General and Desktop • qpushbutton connect • • mrmorph  

      35
      0
      Votes
      35
      Posts
      10699
      Views

      @mrmorph well you are NOT the first to not see it.
    • SOLVED blocking connect()
      General and Desktop • signal & slot connect qt 5.5.0 • • Pogi  

      5
      0
      Votes
      5
      Posts
      2616
      Views

      @Chris-Kawa my sender and receiver is in different thread. I see! you hit all the bullseye! THanks guys! and i now understand the Qt::BlockingQueuedConnection
    • UNSOLVED connection error in QObject::connect()
      General and Desktop • qt 5.5 connect signal&slot • • Pogi  

      2
      0
      Votes
      2
      Posts
      2789
      Views

      Both your classes need to inherit from QObject for the signal/slot mechanism to work. Code blocks are either preceded by 4 spaces (good for one liners): int variable; or they can be enclosed by `` ` (triple back ticks, good for inline elements and longer blocks): #include <iostream> int main (int argc, char * argv[]) { std::cout << "Hello, World!\n"; } Google Markdown syntax for some more markup details.
    • UNSOLVED QObject::connect() vs thread
      General and Desktop • thread connect threading qt5.5.0 • • Pogi  

      4
      0
      Votes
      4
      Posts
      1723
      Views

      There's no multi-threading involved here whatsoever. All code here runs in a single thread (unless the timer object and "this" actually live in different threads). There's an event loop running in your app and timer events are just the same as any other. They get put in a queue and processed one after another. The above will basically mean that your slot is run every time Qt processes messages. It can have very bad influence on your app responsiveness if what you do in the slot is heavy. The most obvious question is: if you want a thread why not use an actual QThread instead of emulating it like that?
    • UNSOLVED PyQt immediately calling function handler upon setup. Why?
      General and Desktop • pyqt5 signal button connect clicked • • errolflynn  

      4
      0
      Votes
      4
      Posts
      3390
      Views

      @errolflynn You should write self.button1.clicked.connect(ft_handler) - this will register the function ft_handler as a slot for the clicked signal. On http://doc.qt.io/qt-5/qabstractbutton.html you see that the signature of that signal is void clicked(bool checked). In other words, when the signal is activated, your handler is called as ft_handler(checked) where checked is either True or False. Per the signature of the clicked signal, this is the only information you will get out of the signal. If you want to pass additional parameters, you indeed will need to create a separate function that encodes those extra parameters and passes them to the handler. In Python it makes a lot of sense to use a lambda for it, for instance: self.button1.clicked.connect(lambda checked: fct_handler(par1, par2, par3, checked)) Hope this helps
    • SOLVED QVector / QList проблем при използването им със потребителски класове
      Bulgarian • qtimer connect qcoreapplicatio qtservice • • pecuna91  

      27
      0
      Votes
      27
      Posts
      8276
      Views

      @Stoyan error: passing 'const Operation' as 'this' argument of 'int Operation::setAttribute(QString, QString)' discards qualifiers [-fpermissive] operations.at(i).setAttribute(Aname,Value); Не мога да разбера защо се получава това съобщение в Task класа, опитвайки се да извикам метода SetAttribute за операция във вектора. Const Operation не знам откъде идва вътре в тази функция конкретно, след като подавам само id-то на операцията. Подобна е грешката и при Task сетване на атрибут: scheduledtopservice\scheduler.cpp:31: error: passing 'const Task' as 'this' argument of 'int Task::setAttribute(QString, QString)' discards qualifiers [-fpermissive] tasks.at(k).setAttribute("state","running"); ПП: Успях да го реша проблема. Разбрах че .at() връща const обект, затова използвах [i] за индекс. task.cpp:17: warning: base class 'class BaseObject' should be explicitly initialized in the copy constructor [-Wextra] Task::Task(const Task &obj) Това как мога да го оправя, четох че създавало още 1 копие на BaseObject така. Но не е като експлицитния конструктор сякаш : BaseObject ( const BaseObject &obj) ако долепя до Copy конструктора на Task. Не съм сигурен, но май просто като сложих : BaseObject() и се изчисти предупреждението. Така ли трябвa да бъде ?
    • Connect one object to many objects of same type.
      General and Desktop • connect objects multiple • • code_fodder  

      8
      0
      Votes
      8
      Posts
      2953
      Views

      @SGaist Thanks, I looked into QSignalMapper, but it seems to have limitations, for example you can only pass one parameter and you can really just map one slot/signal. I could probably make it work by passing a structure (and register that with the meta compiler), and then use multiple QSignalMappers... but, at least for my case, I find that creating my own object to be much simpler both to implement and to read.
    • [Solved] Use of signal-slot connect in Windows 10
      General and Desktop • windows 10 qt 5.4.1 connect connect failure signal-slot • • koahnig  

      24
      0
      Votes
      24
      Posts
      8290
      Views

      @SGaist Yes. That was intensional. I just tested that my installation is still providing the message. Thanks a lot anyway.
    • Known bug in Qt 5.5 with QProcess signals?
      General and Desktop • signal & slot qprocess qt 5.5 connect shared library signals osx yosemite • • maximo  

      2
      0
      Votes
      2
      Posts
      1142
      Views

      I figured it out. I needed to set my QObject and QCore stuff properly. In the .pro file of the shared library, I added: QT += core In the shared library's .h file, I switched this: class CTSCANSHARED_EXPORT ctScan { public: ...blah blah... with this: class CTSCANSHARED_EXPORT ctScan: public QObject { Q_OBJECT public: ...blah blah... And then ensured the shared library's .h file had this: #include <QObject> And then it compiled properly.