qt4

How can I set PATH variable using QT?

倖福魔咒の 提交于 2019-12-21 18:03:43
问题 How can I get and set PATH variable using QT 4.8? I know I can get PATH variable values using getenv from the STL but don't know how to set it using STL or any Qt based method? If QT has a function for it, I would like to know and use it rather than going and using Windows API for it. 回答1: You can use setenv from stdlib.h to set PATH to a new value. setenv("PATH","/new/path/value",1) However, this is a non-standard extension to the standard headers, and will only affect sub-processes spawned

QWidget how to receive keyPressEvent inside child widgets

痞子三分冷 提交于 2019-12-21 17:36:09
问题 I have one main Widget and inside this main widget I have QListWidget and two buttons. I have override the keyPressEvent inside the main widget (inherited from QWidget ). I can receive the keyPress events when focus is not on QListWidget , but when focus is inside the QListWidget I am unable to receive these keyPress events. Below is the code I have used to achieve this: MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); this-

Microsoft Visual Studio: Loading resources in Qt application (without plug-in)

六月ゝ 毕业季﹏ 提交于 2019-12-21 17:19:15
问题 We don't have a Qt plug-in installed for MSVS, and it makes me wonder how/whether it is possible to load resources (images, etc) to the application. 回答1: Yes, you can load ressources. Unfortunately, the qrc Editor which create qrc files is part of the Qt Addin for VS... But you can create this xml file by hands, for the format see here Once the qrc file created, you have at least two possibilities : A) Use qmake Add a reference to your qrc file in your pro file : RESOURCES =

Unable to Launch Qt uic

我是研究僧i 提交于 2019-12-21 15:38:15
问题 I have installed Qt designer 4.8.2, Pyside, and Python 3.3. When I create a form with Qt designer I am not able to see the code when clicking on view code. The error message is:"Unable to launch C:\Qt\4.8.2\bin\uic". I have the pyuic under C:\Python33\Lib\site-packages\PyQt4\uic. Please help. 回答1: Although you can certainly use Qt Designer for creating UIs for PySide/PyQt, you should be aware that it is primarily a C++ tool - it doesn't have any built in support for Python. So the "View Code.

A QLineEdit with a QCompleter won't show the QCompleter's popup menu with an empty text field

旧街凉风 提交于 2019-12-21 12:26:37
问题 I have a QLineEdit , with a QCompleter object associated to it. If the user enters at least one character, the popup menu from the QCompleter is shown, but when the user deletes the last character (thus leaving the field empty) the popup disappears. Is there any way to make it show even when the QLineEdit 's text is empty? 回答1: you should be able to force completer's popup window to get shown once your line edit text is erased by using QCompliter::complete slot: lineEdit->completer()-

How to pass data from a QDialog?

安稳与你 提交于 2019-12-21 11:29:57
问题 In Qt, what is the most elegant way to pass data from a QDialog subclass to the component that started the dialog in the cases where you need to pass down something more complex than a boolean or an integer return code? I'm thinking emit a custom signal from the accept() slot but is there something else? 回答1: QDialog has its own message loop and since it stops your application workflow, I usually use the following scheme: MyQDialog dialog(this); dialog.setFoo("blah blah blah"); if(dialog.exec

Where to control the QWizard button?

不想你离开。 提交于 2019-12-21 09:15:12
问题 I'm using Qt, and I use a QWizard object which contains several pages. when it comes to a specific page, I want to hide the "Next" button first, and shows it after the user do something (such as clicking on a radiobutton...) I want to do some customize control of the wizard when this specific page shows up. the question is, I know how to hide the button, but I don't know which function I should use. I tried the QWizardPage constructor, the initializePage function, the "show" function, but all

QPushButton creates empty space on Mac OS X resulting in ugly layouts

怎甘沉沦 提交于 2019-12-21 05:43:09
问题 I recently moved to Mac OS X and noticed that the Dialogs in one of my applications look kind of strange... I have several Dialogs that are basically a simple form that has configurable paths: Label: <QLineEdit> <QPushButton (opens file dialog)> Label: ... The Dialog is organized in a QGridLayout, it looks fine on Ubuntu: On Mac OS X there is a big empty space below the QPushButtons row which makes the whole thing look strange: I found this bug report which was apparently silently closed:

How do I make apps smaller with qmake and macdeployqt

£可爱£侵袭症+ 提交于 2019-12-21 04:49:19
问题 How do I make apps smaller with qmake and macdeployqt? I have set QT = core gui in the projects .pro file and run qmake and macdeployqt on the resulting app. The problem is that the program is bundling QtNetwork, QtScript, QtSvg etc. I've tried setting QT -= network script svg (and then make clean, rm -rf *.app, qmake, make). In total the app is 32 MB. .pro file: TEMPLATE = app TARGET = throw DEPENDPATH += . INCLUDEPATH += . CONFIG += x86_64 release QT = core gui unix { CONFIG += link

Qt Color Picker Widget?

删除回忆录丶 提交于 2019-12-21 04:41:34
问题 I have a QDialog subclass that presents some options to the user for their selecting. One of these options is a color. I have seen the QColorDialog, and I need something much simpler, that is also a regular widget so I can add to my layout as part of my dialog. Does Qt offer anything like this or will I have to make my own? If the latter, what is the best strategy? 回答1: Have you looked at the QtColorPicker, part of Qt Solutions? QtColorPicker provides a small widget in the form of a QComboBox