qt4

QExplicitlySharedPointer and inheritance

老子叫甜甜 提交于 2019-12-24 21:40:20
问题 What is the best way to use QExplicitlySharedPointer and inherited classes. I would like when the BaseClass exits on it's own to have a my d pointer be QExplicitlySharedPointer<BaseClassPrivate> and when I have a Derived class on top of this base class I'd like to have d be a QExplicitlySharedPointer<DerivedClassPrivate> . I tried making DerivedClassPrivate inherit from BaseClassPrivate, and then make the d pointer protected and re-define the d-pointer in my derived class, but it seems now

Why can I not assign this Qt property?

回眸只為那壹抹淺笑 提交于 2019-12-24 19:57:34
问题 Qt throws the following error at runtime. Unable to assign LIMITS_T to LIMITS_T I assume that Qt needs more meta data information, but I don't know what I missing. I have done everything to declare the metatype: limits.h class LIMITS_T : public QObject{ Q_OBJECT Q_PROPERTY(float min READ readMin WRITE writeMin NOTIFY minChanged) public: LIMITS_T() : QObject() {} LIMITS_T(const LIMITS_T& limit) : QObject() { this->min = limit.min; } float min = 0; float readMin() { return min; } void writeMin

DllMain and Qt Mfc Migration

随声附和 提交于 2019-12-24 18:57:22
问题 I am using the Mfc to Qt migration solution, to migrate my Mfc plugin to Qt. My Mfc plugin is loaded in third party Mfc app. Basically I am using the following example Qt based Application Extension : BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID ) { static bool ownApplication = FALSE; if ( dwReason == DLL_PROCESS_ATTACH ) ownApplication = QMfcApp::pluginInstance( hInstance ); if ( dwReason == DLL_PROCESS_DETACH && ownApplication ) delete qApp; return TRUE; } I read the

QFileSystemModel and QTreeView showing dirs only. How to hide expansion marks against the empty dirs?

天涯浪子 提交于 2019-12-24 15:57:39
问题 I'm building somewhat like standard file explorer - left pane is for folders tree, and the right one to display files within selected folder. QTreeView with QFileSystemModel is used to display folders. Model's filter is set to QDir::Dirs | QDir::NoDotAndDotDot to list dirs only, no files. I want to display expansion marks only against the folders with subfolders, i. e. if some dir is empty or contains only files, it shouldn't be expandable. But instead, tree view keeps expansion marks against

Replace current QWidget to another QWidget in QMainWindow

浪尽此生 提交于 2019-12-24 15:25:53
问题 I have some QWidget class which ui files are separate from QMainWindow ui file. how to add or replace current QWidet which is glued to QMainWindow into other QWidget from different class and ui files on the same QMainWindow ? 回答1: If I understand you correctly, you are currently displaying one widget and upon an action, you want to hide that widget and display another one in its place. If this is correct, you might want to look at QStackedLayout. 回答2: Add your widget headers (note that you

Get the index of a QTableWidget row knowing its elements

我的梦境 提交于 2019-12-24 14:28:37
问题 [I'm using PyQt4, but I think this Qt4 issue is not Python specific.] I have a QTableWidget . In each row, the first column holds a button. When clicked, the row is removed. To remove the row, I use removeRow(int row) method, which takes as argument the index of the row. When connecting the signal, I can't know the index of the row because it might change in the meantime (for instance if the first row is removed, all row indexes are changed). The accepted answer here suggests to pass the

QTreeview does not update correctly when items are added to the root

帅比萌擦擦* 提交于 2019-12-24 11:28:47
问题 I've got a treeview, which should show the content of an own datacollection to achieve this, I've implemented a new model for the treeview. When I add an object to any parent Item everything works fine and the new Item is shown in the view, but when I try to add an item to the rootitem, this item does not show up until I add an Object to another parentitem or I reset the model. My method to add rows to the model looks like this: bool TreeModel::insertRows(int row, int count, const QModelIndex

HowTo draw QTreeWidgetItem with different style?

淺唱寂寞╮ 提交于 2019-12-24 09:27:57
问题 Here is the main problem : I'm using QTreeWidget class as a main tree, which must show me this tree structure: [Today] [Row1] [Row2] [SubRow21] [SubRow22] [Row3] [Yesterday] [Row4] [SubRow41] [etc] With Qt Designer I have set this style sheet code: QTreeWidget#treeWidget::item { height: 24px; border: none; background-position: bottom left; background-image: url(:/backgrounds/images/backgrounds/row_back.png); } QTreeWidget#treeWidget::item:selected { color: #000000; background-position: bottom

Win7 MInGW QT MySQL program screams “cannot find -lqsqlmysqld”; where is the missing library?

人盡茶涼 提交于 2019-12-24 08:19:15
问题 I am attempting to make a qt program on Windows 7 that uses a MySQL plugin. I have compiled both qt and the mysql plugin with no problems using my minGW 32bit compiler. However, I keep on getting an error like this: mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory `C:/Users/dhatt/Desktop/testdb2' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN - I"..\..\..\..

How to set Proxy Address using QProcessEnvironment on Linux?

我们两清 提交于 2019-12-24 08:09:26
问题 I am stuck with a simple issue in Qt. I want set proxy address using Qt. The command to set proxy address export http_proxy=http://wwgw.abcd.com:8080 works fine if passed by a terminal manually. but If the same command is run using QProcess, it fails without setting proxy. Even, I tried with QProcessEnvironment as QProcess process_setupProxyServerUrl; QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QString cmd = "http://wwgw.abcd.com:8080"; env.insert("HTTP_PROXY", cmd);