slot

Qt: Connecting signals and slots

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 08:37:45
问题 I have a MainWindow that contains a custom widget with a QTextEdit in it. I would like to create a signal/slot between the MainWindow and the QTextEdit . In MainWindow I have: QObject::connect(ui->Header, SIGNAL(ui->Header->getTextWidget()->textChanged()), this, // this : MainWindow SLOT(headerUpdated())); // Function of MainWindow But this does not work. Is it even possible to create such signal/slot combination? 回答1: why bother - let Qt do all the magic :) Just name your slot (in the

SIGNAL & SLOT macros in Qt : what do they do?

我们两清 提交于 2019-12-12 14:04:45
问题 I'm a beginner in Qt and trying to understand the SIGNAL and SLOT macros. When I'm learning to use the connect method to bind the signal and slot, I found the tutorials on Qt's official reference page uses: connect(obj1, SIGNAL(signal(int)), obj2, SLOT(slot())) However, this also works very well: connect(obj1, &Obj1::signal, obj2, &Obj2::slot) So what exactly do the macros SIGNAL and SLOT do? Do they just look for the signal in the class the object belongs to and return the address of it?

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

北城余情 提交于 2019-12-12 09:11:23
问题 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? 回答1: Update news : I find one solution boolean s

connecting pyqt4 signals in a pyqt4 qobject class

爷,独闯天下 提交于 2019-12-12 00:21:21
问题 I've got two classes; one for my window and one for my controlling object class window(baseClass, testForm): scanStarted = QtCore.pyqtSignal(str) def __init__(self,parent=None): super(window, self).__init__(parent) self.setupUi(self) #other window setup self._scanner.pushScan.clicked.connect(self._scanClicked) def _scanClicked(self): self.scanStarted.emit( self._scanner.getTextData() ) and my controlling object class vis(QtCore.QObject): def __init__(self): self._oreList = [] self._w = window

Dynamic connecting/disconnecting signals and slots

不问归期 提交于 2019-12-11 07:25:49
问题 My program has two states and it can switch between them for some reasons. In these states the program needs to receive different signals, which means it has to connect and disconnect certain signals during the run. How bad is such approach? 回答1: It's a fine approach, I've used it before without issues. Depending on what you're actually doing a QSignalMapper might be of use for you. 来源: https://stackoverflow.com/questions/15274147/dynamic-connecting-disconnecting-signals-and-slots

Qt, QCoreApplication and QFtp

廉价感情. 提交于 2019-12-11 07:17:04
问题 I want to use QFtp for the first time and googled a lot to find out how it should be used. This, among others is a typical example: #include <QCoreApplication> #include <QFtp> #include <QFile> int main(int argc, char ** argv) { QCoreApplication app(argc, argv); QFile *file = new QFile( "C:\\Devel\\THP\\tmp\\test.txt" ); file->open(QIODevice::ReadWrite); QFtp *ftp = new QFtp(); ftp->setTransferMode(QFtp::Active); ftp->connectToHost("ftp.trolltech.com"); ftp->login(); ftp->cd("qt"); ftp->get(

How to pass option tags to a custom element as distributed nodes (aka <slot></slot>)

◇◆丶佛笑我妖孽 提交于 2019-12-11 01:38:44
问题 I have a web component custom element defined like so. <template id="dropdown-template"> <select> <slot></slot> </select> </template> <script> class Dropdown extends HTMLElement { constructor() { super(); const shadowRoot = this.attachShadow({mode: 'open'}); let template = document.getElementById('dropdown-template'); shadowRoot.appendChild(template.content.cloneNode(true)); } } customElements.define("drop-down", Dropdown); </script> When trying to use it, I try and pass option tags with

multiple signals for one slot

折月煮酒 提交于 2019-12-10 11:04:19
问题 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

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

自作多情 提交于 2019-12-09 20:48:59
问题 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

Elegant way to disconnect slot after first call

自古美人都是妖i 提交于 2019-12-09 10:31:03
问题 Inside the constructor, there is a connection: connect(&amskspace::on_board_computer_model::self(), SIGNAL(camera_status_changed(const amskspace::camera_status_t&)), this, SLOT(set_camera_status(const amskspace::camera_status_t&))); And the method: void camera_model:: set_camera_status(const amskspace::camera_status_t& status) { disconnect(&amskspace::on_board_computer_model::self(), SIGNAL(camera_status_changed(const amskspace::camera_status_t&)), this, SLOT(set_camera_status(const amskspace