slot

A slot can take less arguments than provided by the signal, HOW? - Qt

谁说胖子不能爱 提交于 2019-12-08 11:56:18
问题 I have a signal which its declaration is: void removed(int sPI, int sWID , int ePI, int eWID); I want to connect it to a slots twice, first needs sPI and sWID arguments and other slot needs ePI and eWID. The slot declaration is: void disconnect(int i, int wID = 0); ( I want when removed() emits, disconnect(sPI, sWID) and also disconnect(ePI, eWID) ) Please help me in writing QObject::connect() statement. Thanks. 回答1: For the first, "disconnect(sPI, sWID)", just do: connect(x, SIGNAL(removed

Passing data between 2 windows. Qt

泪湿孤枕 提交于 2019-12-08 11:26:41
问题 I am new to qt, so I didn't quite get the signal slot mechanism. here is my setup. Dialog class (its a dialog with a lineEdit called "lineEdit") mainwindow class (that has a lineEdit too) I have this : void MainWindow::keyPressEvent(QKeyEvent *event) { int i=event->key(); //char z=(char)i; // connect(ui->lineEdit, SIGNAL(textChanged(QString)), dialog, SLOT(setText(QString))); if(i>=48&&i<=57) { QString s= QString::number(i-'0'); q+=s; ui->lineEdit->setText(q); } I want to set the text of

How to connect in Qt signal and slot in dynamically added buttons to get in slot index of added button?

对着背影说爱祢 提交于 2019-12-08 06:26:00
问题 I have list with pointers QPushButton: QList<QPushButton*> listButtons; In this code I am adding dynamically buttons listButtons.push_back(new QPushButton("Cancel", this)); connect(listButtons.last(), SIGNAL (clicked(listButtons.size)), this, SLOT(handleButton(int))); //this doesn't work How can I also save index of every button, so I can keep track, what button user clicked, because every button has to cancel specific task. I use C++98, so I can not use Lambda function 回答1: You have to use

Associate signal and slot to a qcheckbox create dynamically

一笑奈何 提交于 2019-12-07 18:54:25
I've got a very specific problem so I'm going to try to be as clear as possible. I've got a QTabWidget which contains QTableWidget , every line of my QTableWidget is create dynamically by reading a file. As you may see, when I create a line, I add a qCheckBox at the end. My goal now, is to send this line to the QTableWidget in the last tab of my QtableTab when I click on the qCheckBox ( and to delete this line when I uncheck the qCheckBox ). So every time I create a line dynamically, I try to associate to my qCheckBox a signal : QObject::connect(pCheckBox, SIGNAL(clicked()), this, SLOT

Temporarily block signals between two QObjects

点点圈 提交于 2019-12-07 05:43:51
问题 I would like to generically and temporarily block the signals between two QObjects without modifying the other signals/slots behavior, and without knowing their contexts. Something like QObject::blockSignals(bool), but only acting between two QObjects . That is, implementing the following SignalBlocker::blockSignals(bool) function: class SignalBlocker { public: SignalBlocker(QObject *sender, QObject *receiver) : mSender(sender), mReceiver(receiver) {} void blockSignals(bool block); private:

multiple signals for one slot

雨燕双飞 提交于 2019-12-06 05:26:27
For my GUI i would like to have two pairs of buttons that scroll up and down a scrollarea. The first set of buttons should work on say scrollarea1 and the second set of buttons should work on a scrollarea2. The widgets that I put in the scrollarea are called viewport1 and viewport2. Since both both set of buttons should do the same (scrolling up and down) I thought I would make two slots called scrollUp and scrollDown that would handle the scrolling for both sets of buttons. Unfortunately I cannot make this work and need some help. I have tried the following: QPushButton up; QPushButton down;

Samsung android 6.0 how to get dual sim call logs with sim slot id?

蓝咒 提交于 2019-12-04 17:24:51
Samsung(dual sim) before offical android 6.0(not cm) device, I could get call logs with sim slot id, but Samsung(dual sim) android 6.0+ device I get an issue: String slotId = cursor.getString(cursor.getColumnIndex(CallLog.Calls.PHONE_ACCOUNT_ID)); <i>slotId</i> = null; but in another device (Huawei mate 8) is work fine Did samsung modify the com.android.providers.contacts and contacts2.db? Can someone guide through the solution for this? Update news : I find one solution boolean s_bSamsung; if (Build.VERSION_CODES.M <= Build.VERSION.SDK_INT && s_bSamsung){ uri = Uri.parse("content://logs/call"

wit.ai + slot based bot + save entities values in client

心不动则不痛 提交于 2019-12-04 14:35:20
I am trying out a sample in wit.ai, here is the link : https://wit.ai/Nayana-Manchi/CreditCardApp/stories The first story "BalanceEnquiry” is a slot based story. The happy scenario works fine. To test “cardnumbermissing” branch, I would type in “I want my credit card balance on the card and my name is Nayana”. Here the card number last 4 digits are missing. It ask for the last 4 digits of the card and then I would enter the last 4 digits of the card. But here it does not get name entity which was sent in earlier message. How do I save the entity value “name” which was sent in the previous step

R: what are Slots?

北城以北 提交于 2019-12-04 07:35:20
问题 Does anyone know what a slot is in R? I did not find the explanation of its meaning. I get a recursive definition: "Slot function returns or set information about the individual slots of an objects" Help would be appreciated, Thanks - Alley 回答1: Slots are linked to S4 objects. A slot can be seen as a part, element or a "property" of an object. Say you have a car object, then you can have the slots "price", "number of doors", "type of engine", "mileage". Internally, that is represented a list.

how to pass qobject as argument from signal to slot in qt connect

你。 提交于 2019-12-03 14:28:00
问题 My original code passed a QStringList from the signal to the slot and then returned a QList. Everything worked fine but I needed to change both the QStringList and QList into 2 different subclassed QObjects. Since then I have been receiving errors like "synthesized method first required here" or it simply crashes without any error message. I understand that qt copies all arguments passed in a queued connection and a qobject cannot be copied. So instead of returning a qobject I thought I would