slot

How to add a list of QActions to a QMenu and handle them with a single slot?

大城市里の小女人 提交于 2019-11-29 06:10:25
First, I have a list of QWidget s that I won't know the length of until runtime. I then create a QListWidget where I show them and when someone clicks them I use the signal currentItemChanged(QListWidgetItem*, QListWidgetItem*) to catch it and get the clicked item's index. Now I want to do a similar thing in the QMenu . I will know the list when the QMenu and its actions get built, but I won't be able to hard code this. How can I create actions, catch their signals and connect them to the same slot which does different things depending on the action's position (index) in the menu list? There

No such Slot/Signals (Qt)

让人想犯罪 __ 提交于 2019-11-28 14:41:28
Object::connect: No such signal RollsRoyceTab::signal_aValueChange(int aValue) ?????? I have class RollsRoyceTab : public QWidget { Q_OBJECT public: RollsRoyceTab(QWidget *parent = 0); public slots: void aValueChange(int); void bValueChange(int); void cValueChange(int); void rrValuesHolder(int aValue, int bValue, int cValue); signals: void signal_aValueChange(int aValue); void signal_bValueChange(int bValue); void signal_cValueChange(int cValue); private: ......... int aValue, bValue, cValue; }; ............ connect(this,SIGNAL(signal_aValueChange(int aValue)),this,SLOT(rrValuesHolder(int

Qt signal slot connection - QNetworkAccessManager

徘徊边缘 提交于 2019-11-28 08:56:19
问题 Im new in Qt and im trying to understand the following signal-slot connection: m_networkManager = new QNetworkAccessManager(this); QNetworkReply *reply = m_networkManager->get(request); connect(reply, SIGNAL(finished()),this, SLOT(onRequestCompleted())); Why we connect the "finished" signal after the get-request?...What happened, if the network connection in line-2 was faster executed before the slot connection (line-3) was made? I know, that this code will work. but i want to understand how

Qt QWEBview JavaScript callback

旧时模样 提交于 2019-11-27 18:52:57
How to pass a function "pointer" from JavaScript to a slot? in JavaScript: function f1() { alert("f1"); } qtclass.submit(f1); and in Qt: public slots: void submit(void * ptr) { (void)ptr; } I need the "f1", function to get fired in the JavaScript from the c++, once some processing is done. Also I do not know in advance the name of the function pointer. you should be able to execute your script using QWebFrame::evaluateJavaScript method. See if an example below would work for you: initializing webview: QWebView *view = new QWebView(this->centralWidget()); view->load(QUrl("file:///home//test

How to properly document S4 class slots using Roxygen2?

老子叫甜甜 提交于 2019-11-27 16:57:21
For documenting classes with roxygen(2), specifying a title and description/details appears to be the same as for functions, methods, data, etc. However, slots and inheritance are their own sort of animal. What is the best practice -- current or planned -- for documenting S4 classes in roxygen2? Due Diligence: I found mention of an @slot tag in early descriptions of roxygen. A 2008 R-forge mailing list post seems to indicate that this is dead, and there is no support for @slot in roxygen: Is this true of roxygen2? The previously-mentioned post suggests a user should instead make their own

No such Slot/Signals (Qt)

坚强是说给别人听的谎言 提交于 2019-11-27 08:53:44
问题 Object::connect: No such signal RollsRoyceTab::signal_aValueChange(int aValue) ?????? I have class RollsRoyceTab : public QWidget { Q_OBJECT public: RollsRoyceTab(QWidget *parent = 0); public slots: void aValueChange(int); void bValueChange(int); void cValueChange(int); void rrValuesHolder(int aValue, int bValue, int cValue); signals: void signal_aValueChange(int aValue); void signal_bValueChange(int bValue); void signal_cValueChange(int cValue); private: ......... int aValue, bValue, cValue;

signals and slots in multilayered UI widgets

旧街凉风 提交于 2019-11-27 05:38:46
Let's say we have the follogin UI: +--------------------------+ |W1 +--------------+ | | |W2 | | | | +----------+ | | | | |W3 | | | | | +----------+ | | | | | | | +--------------+ | +--------------------------+ W3 is interested in a certain signal emited in W1 (or a level below, i.e. qApp). The idea is to develop W3 independently. But somebody has to do the signal/slot connection. What would be a good practice/recommended way of connecting the signal emited in W1 into slot in W3 if we want W3 not to know about any other widget, and we don't want W1 to know about W3 either? Solution 1: Connect

Qt QWEBview JavaScript callback

丶灬走出姿态 提交于 2019-11-27 04:19:47
问题 How to pass a function "pointer" from JavaScript to a slot? in JavaScript: function f1() { alert("f1"); } qtclass.submit(f1); and in Qt: public slots: void submit(void * ptr) { (void)ptr; } I need the "f1", function to get fired in the JavaScript from the c++, once some processing is done. Also I do not know in advance the name of the function pointer. 回答1: you should be able to execute your script using QWebFrame::evaluateJavaScript method. See if an example below would work for you:

How to properly document S4 class slots using Roxygen2?

我只是一个虾纸丫 提交于 2019-11-26 18:48:47
问题 For documenting classes with roxygen(2), specifying a title and description/details appears to be the same as for functions, methods, data, etc. However, slots and inheritance are their own sort of animal. What is the best practice -- current or planned -- for documenting S4 classes in roxygen2? Due Diligence: I found mention of an @slot tag in early descriptions of roxygen. A 2008 R-forge mailing list post seems to indicate that this is dead, and there is no support for @slot in roxygen: Is

How delete and deleteLater works with regards to signals and slots in Qt?

ⅰ亾dé卋堺 提交于 2019-11-26 15:12:36
There is an object of class QNetworkReply. There is a slot (in some other object) connected to its finished() signal. Signals are synchronous (the default ones). There is only one thread. At some moment of time I want to get rid of both of the objects. No more signals or anything from them. I want them gone. Well, I thought, I'll use delete obj1; delete obj2; But can I really? The specs for ~QObject say: Deleting a QObject while pending events are waiting to be delivered can cause a crash. What are the 'pending events'? Could that mean that while I'm calling my delete , there are already some