qt4

PyQt: how to handle auto-resize of widgets when their content changes

*爱你&永不变心* 提交于 2019-12-21 03:53:24
问题 I am having some issues with the size of qt4 widgets when their content changes. I will illustrate my problems with two simple scenarios: Scenario 1: I have a QLineEdit widget. Sometimes, when I'm changing its content using QLineEdit.setText(), the one-line string doesn't fit into the widget at its current size anymore. I must select the widget and use the arrow keys to scroll the string in both directions in order to see it all. Scenario 2: I have a QTextEdit widget. Sometimes, when I'm

How to restart Linux from inside a C++ program?

混江龙づ霸主 提交于 2019-12-20 19:45:21
问题 I have a Qt 4 GUI where I need to have a option in a drop-down menu that allows the user to choose to restart the computer. I realize this might seem redunant with the ability to restart the computer in other ways, but the choice needs to stay there. I've tried using system() to call the following: a suid-root shell script a non-suid shell script a suid-root binary program and all of them just cause reboot: must be superuser to be printed. Using system() to call reboot directly does the same

Where can I find Qt4 source code editor widget? [closed]

拈花ヽ惹草 提交于 2019-12-20 19:42:03
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I want to provide a QtScript source code editor in my application. It would be great if this would have source code highlighting and auto completion. So I don't want to reinvent the wheel: Is there already a quite good widget for that? I could not find anything on Google... 回答1: See QScintilla. It has Javascript

QGroupBox border

泪湿孤枕 提交于 2019-12-20 17:35:30
问题 After searching for a while I saw that they way to set a visible border on a groupbox is to use the StyleSheet property. I added: border: 2px solid gray; but there are a couple of problems. 1) Everything inside the groupbox also inherits this setting! 2) The border has a little hole/piece missing near the title. Here is a picture of what I'm talking about: Anyone know how to do this properly? Thanks, David 回答1: The first problem is simple enough When you add a stylesheet to a control it

Qt 4.8, Visual Studio 2013 compiling error

不打扰是莪最后的温柔 提交于 2019-12-20 14:39:50
问题 Am folowing this tutorial to compile Qt 4.8 with visual Studio 2013 but after running nmake i get: C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(103) : error C2491: 'round' : definition of dllimport function not allowed C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(110) : error C2491: 'roundf' : definition of dllimport function not allowed C:\Qt\4.8.5.src\src\3rdparty\javascriptcore\JavaScriptCore\wtf/MathExtras.h(128) : error C2084:

gdb remote cross debugging fails with “Remote 'g' packet reply is too long”

拈花ヽ惹草 提交于 2019-12-20 11:52:26
问题 I have a problem with remote debugging. Host: laptop intel i5 with ubuntu 10.10 x86 Target: Freescale iMX35 (iMX35 PDK) arm 11 Development environment: Qt Creator 2.1RC and Qt4.7.1 libraries. Arm compiler in path: /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin arm-none-linux-gnueabi-gcc-4.1.2 arm-none-linux-gnueabi-objdump arm-none-linux-gnueabi-addr2line arm-none-linux-gnueabi-gccbug arm-none-linux-gnueabi-ranlib arm-none-linux-gnueabi-ar arm-none-linux

Command line parser for Qt4

烂漫一生 提交于 2019-12-20 08:37:36
问题 I am looking for a command line parser for Qt4. I did a small google search, and found this: http://www.froglogic.com/pg?id=PublicationsFreeware&category=getopt however it lacks support for "--enable-foo" and "--disable-foo" switches. Besides that, it looks like a real winner. EDIT: It seems Frologic removed this. So the best options I see are using Boost (which is not API nor ABI stable) or forking the support for kdelibs. Yay... 回答1: Since Qt 5.2 you can finally find a solution in QtCore

Spawning one window from another window on button click in qt4

南楼画角 提交于 2019-12-20 07:08:55
问题 I've created two windows using qt4 designer, and would like to link them together. I put them both in a folder and created a file outside the directory, which I'm importing them with. I can open both windows at the same time, but that's not what I would like to do. I would like to make it so that when a button is pushed on one window, it opens the other window, then closes the first window, so the second window is the only one left open. This is the code for the first window, with comments

Is QImage able to open and render pure 16-bit images?

一曲冷凌霜 提交于 2019-12-20 04:26:11
问题 I think the headline already explains what I want to know. Is there a possible way to open and save images with 16-bit with Qt? And I don't mean the 3*8=24bit or 4*8=32bit, what is quite the same as a pure 8-bit image, I mean pure 16-bit for R, G and B. 回答1: Contrary to what Patrice says, there is no 16 bits per component format in QImage . The most you can get is QImage::Format_ARGB32 at 8 bits per component. Even if you used 8 bits indexed mode, the color tables do not support more than 8

Using QApplication with command line arguments

≡放荡痞女 提交于 2019-12-20 03:51:05
问题 QApplication::QApplication ( int & argc, char ** argv ) Initializes the window system and constructs an application object with argc command line arguments in argv. Warning: The data referred to by argc and argv must stay valid for the entire lifetime of the QApplication object. In addition, argc must be greater than zero and argv must contain at least one valid character string. From this link: http://doc.qt.io/qt-4.8/qapplication.html#QApplication What can be the arguments to the executable