qtcore

QMetaObject::invokeMethod doesn't find methods with parameters

跟風遠走 提交于 2019-11-28 07:46:31
问题 This is a follow up of QMetaObject::invokeMethod doesn't find the method. Invoking a method without paramters works. But extending the previous question to methods with parameters brings me back to failure again. See the following example script in Python: from PySide import QtCore class Example(QtCore.QObject): def __init__(self): super().__init__() @QtCore.Slot() def dup(self): beep('dup-class') @QtCore.Slot(str) def beep(self, text): print(text) @QtCore.Slot() def dup(self): beep('dup

QSettings::IniFormat values with “,” returned as QStringList

最后都变了- 提交于 2019-11-28 06:11:03
问题 I am using QSettings to parse an ini file: QSettings cfg(path, QSettings::IniFormat); When I obtain a value QVariant qv = cfg.value("title"); containing a comma the variant contains a QStringList instead of a QString title=foo => QString title=foo,bar => QStringList How can I always get strings, or at least obtain the original line ( title=foo,bar ) ? 回答1: You have at least two ways to address this issue, all of them presented below: test.ini title="foo,bar" title_unquoted=foo,bar main.cpp

Qt create Link between folders

安稳与你 提交于 2019-11-28 05:19:46
问题 I have to build a small dialog that creates a symbolic link to a folder. In windows I would use mklink /D command. Is there a possibility to create such links in Qt? I have only seen QFile creating links between files and that they need to end with .lnk (http://qt-project.org/doc/qt-4.8/qfile.html#link) QDir on the other hand does not provide anything. Any suggestions? Best regards, Richard 回答1: Is there a possibility to create such links in Qt? Yes, it is, but only on Unix. Unfortunately,

How to Compress Slot Calls When Using Queued Connection in Qt?

北战南征 提交于 2019-11-27 12:25:26
After reading some articles like this about Qt Signal-Slot communications I still have a question concerning the queued connection. If I have some threads sending signals all the time to each other and lets say one thread_slow is running a slow method in it's event loop and another thread_fast is running a fast one that sends multiple signals while the other thread is still running it's slow method.....when the slow method from thread_slow returns to the event loop, will it process all the signals that were sent before by thread_fast or just the last one (all the signals are the same type)? If

Qt: *.pro vs *.pri

亡梦爱人 提交于 2019-11-27 11:52:05
What is the difference between *.pro and *.pri configuration files for qmake? What should go into a *.pro file and what should go into a *.pri file? A .pro file is what you would run QMake on. A .pri file is included by a .pro file. Other than that there is not much of a difference between the two. Example usage could be if you have different builds which need different options. You could put shared information in the .pro, while deferring the options to various .pri files. A bit more information, although admittedly not much more, can be found here . lpapp There is one main difference between

How to parse HTML with C++/Qt?

天涯浪子 提交于 2019-11-27 02:53:31
问题 How can i parse the following HTML <body> <span style="font-size:11px">12345</span> <a>Hello<a> </body> I would like to retrive the data "12345" from a "span" with style="font-size:11px" from www.testtest.com, but I only want the that very data, and nothing else. How can I accomplish this? 回答1: EDIT: From the Qt 5.6 release blog post: With 5.6, Qt WebKit and Qt Quick 1 will no longer be supported and are dropped from the release. The source code for these modules will still be available. So,

Ncurses and Qt Interoperability

你。 提交于 2019-11-26 22:59:25
Having a Qt and ncurses based application, what is the best way to refresh the screen every second, while waiting for user input? (e.g. show the clock and get user input). I need the best compromise between CPU usage and application responsiveness. To be more specific with the question, how to get user input and still use QTimer and the signal-slot mechanism? When using the code below, the timers doen't work. nodelay(stdscr,true); while(1) { sleep(1); getch(); processInput(); } Use QSocketNotifier to be notified of things being available on stdin . Call nonblocking getch() in a loop until no

Why QVector::size returns int?

被刻印的时光 ゝ 提交于 2019-11-26 21:09:00
问题 std::vector::size() returns a size_type which is unsigned and usually the same as size_t , e.g. it is 8 bytes on 64bit platforms. In constrast, QVector::size() returns an int which is usually 4 bytes even on 64bit platforms, and at that it is signed, which means it can only go half way to 2^32. Why is that? This seems quite illogical and also technically limiting, and while it is nor very likely that you may ever need more than 2^32 number of elements, the usage of signed int cuts that range

QtCore.QObject.connect in a loop only affects the last instance

耗尽温柔 提交于 2019-11-26 15:33:16
I have got a loop. I created a QCheckBox and put it in a QTableWidget cell, and everything is Ok. In each step of loop I have called a connect function, for myslot SLOT, but only the last QCheckBox instance is applied. I googled a lot and have found many people have my problem. I have applied their solutions, but my problem remains. for row in xrange(len(uniqueFields)): instance = QtGui.QCheckBox(uniqueFields[row], findInstance.tableWidget) print QtCore.QObject.connect(instance, QtCore.SIGNAL(_fromUtf8("stateChanged (int)")), lambda: findInstance.projectsInstance.myslot( "TWCH", findInstance,

QtCore.QObject.connect in a loop only affects the last instance

谁说我不能喝 提交于 2019-11-26 04:28:21
问题 I have got a loop. I created a QCheckBox and put it in a QTableWidget cell, and everything is Ok. In each step of loop I have called a connect function, for myslot SLOT, but only the last QCheckBox instance is applied. I googled a lot and have found many people have my problem. I have applied their solutions, but my problem remains. for row in xrange(len(uniqueFields)): instance = QtGui.QCheckBox(uniqueFields[row], findInstance.tableWidget) print QtCore.QObject.connect(instance, QtCore.SIGNAL