qt4

Undefined reference in Qt4

空扰寡人 提交于 2019-12-13 07:10:06
问题 I'm trying to change the user agent in Qt4. My code: main.cpp: #include <QApplication> #include <QDeclarativeContext> #include <QDeclarativeEngine> #include "qmlapplicationviewer.h" #include "NetworkAccessManagerFactory.h" #ifdef DEBUG #include "logger.h" #endif Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer<QApplication> app(createApplication(argc, argv)); app->setOrganizationName("..."); app->setApplicationName("..."); QmlApplicationViewer viewer; /*and stuff related to it*

How to set a Qt button's icons using stylesheet?

99封情书 提交于 2019-12-13 06:29:11
问题 I would like to set a button's icons using stylesheets, like this : #include <QToolButton> #include <QApplication> QString FormStyleSheetString( const QString & name ) { const QString thisItemStyle( "QToolButton:enabled { image: url(" + name + "_normal.png); } " "QToolButton:pressed { image: url(" + name + "_pressed.png); } " "QToolButton:disabled { image: url(" + name + "_disabled.png); } " ); return thisItemStyle; } int main(int argc, char * argv[]) { QApplication qapp(argc,argv);

Some of QT examples are not working

懵懂的女人 提交于 2019-12-13 05:32:41
问题 After building QT via my Visual Studio 2010 as described here I find out that most part of demos doesn't work. When I open qtdemo.exe and try to Launch some of them (for example Demonstrations->Browser , Demonstrations->Media Player , Qt Declarative Examples->TV Tennis , ...) the same error message "Could not launch the example. Ensure that it has been built." I get. 回答1: If you followed these configure flags from here, then obviously not all examples will work. These are the ones for a

How to save and load QListWidjet contents to/from QSetting with PyQt4?

旧巷老猫 提交于 2019-12-13 04:12:12
问题 I've got a QListWidget in my PyQt4 app. It contains folders paths. I want to save its contents to QSettings and load them later. I used this code to do this: def foldersSave(self): folders = {} '''create dict to store data''' foldersnum = self.configDialog.FolderLIST.count() '''get number of items''' if foldersnum: for i in range(foldersnum): folders[i] = self.configDialog.FolderLIST.item(i).text() '''save items text to dict''' return str(folders) '''return string of folders to store in

An Internet browser Qt4 widget?

感情迁移 提交于 2019-12-13 04:09:06
问题 I'm want to show in the GUI a small box (400x85) that shows in an HTML file over the web. The QtWebKit class got his QWebView widget, but the whole QtWebKit class is VERY heavy, weights 16MB, and slows the init of the application in three seconds. It's not really necessary to load the whole QtWebKit class just to show an HTML page. It is possible to use IE's built in web engine? (Through an ActiveX Object or something?) 回答1: You can use Internet Explorer via ActiveQT. There is a c++ example

Qt with XComposite problem

佐手、 提交于 2019-12-13 03:54:30
问题 I'm trying to write a simple program, which redirects all the windows to the backbuffer( as the composite manager does ), then write them to pixmap and save to disk. But I got this error: (.text.startup+0x5e):-1: error: undefined reference to `XCompositeRedirectSubwindows' (.text.startup+0x171):-1: error: undefined reference to `XCompositeNameWindowPixmap' :-1: error: collect2: ld returned 1 exit status Here is the code : #include <QApplication> #include <QDebug> #include <X11/Xlib.h>

How to block/ignore/discard user input events that are older than a certain timeout in Qt 4.8

你离开我真会死。 提交于 2019-12-13 03:48:50
问题 This question might be related to those questions: QEventLoop: get time when an event was scheduled Get the timestamp when a QInputEvent was put onto the queue of the QEventLoop in Qt 4.8 I would like to detect if a user input is older than a certain timeout and block such events if necessary. Imagine scenarios where the UI is not responsive and hangs in the main thread for a few seconds and the user keeps sending input events. Those events are queued and are then processed with a certain

HowTo get work Microsoft Visual Studio 2010 and Qt Visual Studio Add-in?

送分小仙女□ 提交于 2019-12-13 03:39:32
问题 Greetings everyone! Question : does any one have a success with combining Microsoft Visual Studio 2010 with Qt Visual Studio Add-in? I have tried to use MSVS2010 with Qt VS Add-in 1.1.5 , but no luck. PS: no never mind what exactly arch or OS, I used Win7 x32... Thanks! 回答1: I think you have to wait till Qt 4.7 ... Because this one says so.. 来源: https://stackoverflow.com/questions/3475011/howto-get-work-microsoft-visual-studio-2010-and-qt-visual-studio-add-in

Qt menuBar() Error

谁说胖子不能爱 提交于 2019-12-13 03:18:40
问题 I'm in the process of learning Qt4 and working through their tutorials. In this tutorial: http://doc.trolltech.com/4.5/mainwindows-menus-mainwindow-cpp.html they have the following code: fileMenu = menuBar()->addMenu(tr("&File")); which causes the compiler to throw this error g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I. -o main

Copy files and folders from directory in QT pro file

我怕爱的太早我们不能终老 提交于 2019-12-13 03:11:33
问题 I want to copy all the files and directory from source folder to some other directory the code I tried is below mentioned BINARY_PATH = $$PWD/../Bin/ RESOURCE_PATH = $$PWD/../resources/ QT += core QT -= gui CONFIG += c++11 TARGET = untitled CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp win32 { QMAKE_POST_LINK +=$$quote(cmd /c xcopy /s /q /y /i $${RESOURCE_PATH} $${BINARY_PATH}$$escape_expand(\n\t)) } RESOURCE_PATH contain 2 files and 1 folder The above code is not