qt4

How to integrate flex and bison with Qt project?

删除回忆录丶 提交于 2020-01-02 07:30:33
问题 I am making a GUI program using Qt4, under git source control (Github page). Small part of project requires scanning and parsing. So I want to use flex and bison with the project. I can think of 3 ways- To keep flex and bison files out of project and source control. Generate the C source files and add it to project. Add flex and bison files to project, but run flex and bison commands separately. Integrate properly with IDE (Qt Creator on Ubuntu 12.04) and source control, so that when I build

QStatusBar message disappears on menu hover

为君一笑 提交于 2020-01-02 05:14:08
问题 I have a very basic QMainWindow application that contains a menubar and a statusbar . When I hover over the menu the status message disappears. More precisely, the status message is cleared. I have no idea what is causing this behavior but it's resulting in a very difficult workaround for what I hoped to be trivial behavior. This is problematic for the following reason: I can make the message permanent by adding a QLabel widget to the QStatusBar , but then I get the awkward border. I don't

how to use ui file for making a simple widget?

我是研究僧i 提交于 2020-01-02 03:30:32
问题 i have a simple window with a quit button in qt.The working code is shown below #include <QApplication> #include <QDialog> #include <QPushButton> class MyWidget : public QWidget { public: MyWidget(QWidget *parent = 0); }; MyWidget::MyWidget(QWidget *parent) : QWidget(parent) { setFixedSize(200, 120); QPushButton *btquit = new QPushButton(tr("Quit"), this); btquit->setGeometry(62, 40, 75, 30); btquit->setFont(QFont("Times", 18, QFont::Bold)); connect(btquit, SIGNAL(clicked()), qApp, SLOT(quit(

QWidget.setContentsMargins() appears to be ineffective: why so?

别来无恙 提交于 2020-01-02 01:25:09
问题 Situation: I am working on a Qt4 application constructed in this way (in case parent widgets matter in this issue): QApplication |_ QMainwindow |_ QScrollArea (central widget) |_ QFrame (child of scroll area) |_ QFrame | |_ QLabel | |_ QPixmap |_ QFrame | |_ QLabel | |_ QPixmap |_ QFrame |_ ect... Objective: I want there to be no margins between the sub-QFrames and their QLabels and equally between QLabels and their QPixmap. Method: I have requested to reduce the sub-QFrame’s margins with

error: expected unqualified-id before 'if'

青春壹個敷衍的年華 提交于 2020-01-02 01:14:09
问题 I've googled this error until I'm blue in the face, but haven't been able to relate any of the results to my code. This error seems to be caused, usually, but misplaced or missing braces, parents, etc. It's also been a long time since I wrote any C++, so there could be some obvious, foolish thing that I'm missing. This is a Qt Mobile app that I'm writing in Qt Creator 2.4.0, Based on Qt 4.7.4 (64 bit) Built on Dec 20 2011 at 11:14:33 . #include <QFile> #include <QString> #include <QTextStream

Adding Vertical headers to a QTreeView

大兔子大兔子 提交于 2020-01-01 17:10:46
问题 I have a QTreeView subclass (and QAbstractItemModel subclass) which has a nice horizontal header. I would like to add vertical headers (going down the left side) to match. But unlike QTableView which has separate vertical (setVerticalHeader()) and horizontal headers (setHorizontalHeader()), QTreeView only allows a single header (setHeader()). I know that I can just pretend that the leftmost column is the header and render it with a different background color (I don't need the ability to

How to programmatically change the order of widgets in a layout?

被刻印的时光 ゝ 提交于 2020-01-01 16:22:13
问题 I do have a QVBoxLayout that contains some custom widgets, which themselves mainly consist of a label and two buttons. You can almost speak of some kind of selfmade table in a way. I know that there are ready-made table widgets available, but I'd like to use my own. What I want to achieve is this: when I click the "up" button in one of the widgets, it should move up, or to put it differently: it should change its current position/index within the parent QVBoxLayout in a way that it moves one

QT HTTP Post issue when server requires cookies

依然范特西╮ 提交于 2020-01-01 09:55:13
问题 I have been trying this whole day with no success. Please help in solving the issue. On googling I found many users had this issue but nowhere I could find a solution. I am trying to do HTTP post in QT C++ & I have already tried doing that in python (My question is not a python question, so Qt pros please help ).. I know, I am somewhere wrong in handling cookies and all, so please help. Please provide probable solutions. In python, code is clean and simple. I have stripped error handling and

qml FolderListModel

♀尐吖头ヾ 提交于 2020-01-01 09:18:40
问题 I am trying to use FolderListModel, according to this example like this: ListView { anchors.fill: parent FolderListModel { id: foldermodel folder: "C:/Qt/Projects/" showDirs: true showDotAndDotDot: true nameFilters: ["*"] sortField : "Name" } Component { id: filedelegate Text { text: fileName } } model: foldermodel delegate: filedelegate } i want to show all the files/directories under the base directory, in a recursive way. does any one have an idea how to do that? 回答1: It seems that you

Is is possible to get native menus with Qt4 on Windows 7, 64-bit?

自古美人都是妖i 提交于 2020-01-01 05:40:10
问题 Applications written in Qt (4) do not have native menus when run on Windows 7, 64-bit. This is true for well-known applications as VLC, Lyx, etc. Qt menus do not behave as native menus, which can be annoying. As an example, consider the screenshot below. If the mouse is rapidly moved along the red path, the sub menu will close immediately. For native menus in Windows (and on Macs) there is a delay. This can make it difficult to navigate in the menus, as they will not behave as the user