qt4

Change visible application name (Windows)

只愿长相守 提交于 2019-12-08 05:31:45
问题 I am looking for a way to change my application name (that appears on right click on Windows 7 taskbar): To something more informative like: How do I do that? I am using: Qt 4.7 (MinGW), Windows I have found some info about using certificates and signing executables, but I am not sure if it is what I need. I know how to change icon. Thanks in advance. 回答1: From 5 minutes of experimentation it seem to be coming from the FileDescription field of the VERSIONINFO resource. It also seems like

Implementing drag and drop with QT 4.5 using QT Creator environment

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-08 05:18:59
问题 We're about to commit to Qt and C++ (sigh) to do some cross-platform development. The latest version of Qt 4.5 seems very nice as does the QT Creator IDE, which although simple compared to other IDEs, is a good way to get started. I'm trying to understand how to do drag and drop into QT widgets from the "outside" world. As far as I can tell from the documentation, you're supposed to subclass a widget that you want to have respond to drop events and override some methods (the dragEnterEvent

QLabel sizehint is too small

ぐ巨炮叔叔 提交于 2019-12-08 03:20:46
问题 I have a QAbstractItemDelegate and in the paint method, I am trying to paint the text from a label. But the problem I am seeing is that the size hint of the QLabel is always too small for the text it contains. How can I fix this? For example: QLabel *testlabel = new QLabel(); testlabel->setText("This is some test text that doesnt fit:"); testlabel->adjustSize(); QRect rect(testlabel->geometry()); Qt::Alignment alignFlags = testlabel->alignment(); painter->setFont(testlabel->font()); painter-

How to convert QString to LPCSTR (Unicode)

扶醉桌前 提交于 2019-12-08 02:34:07
问题 how can I convert QString to LPCSTR ? How do I do it when #ifdef UNICODE is defined and when it isn't ? Thanks very much :) 回答1: I guess: QString str("ddddd"); LPCSTR lstr = str.toStdString().c_str(); 回答2: QString can always hold Unicode; LPCSTR is never Unicode. This means that you do have to consider what to do with the characters that won't fit. This isn't a "which method to use" question, but a design question. It's quite possible that in your specific case, you absolutely know that the

PyQt4 SIGNAL/SLOT problem when using sub-directories

▼魔方 西西 提交于 2019-12-08 02:13:32
问题 Thanks in advance for taking the time to read this. Apologies that it is somewhat verbose. But hopefully it fully explains the problem. Stripped code demonstrating the issue is included. I'm having an issue with PyQt4 SIGNAL/SLOTS. While I can make everything work fine if I am writing in a single file, I can't make things work if I some of the functions I wish to use are moved to sub-directories/classes. I've looked through the Python Bindings document I can see how this works when using a

QAbstractItemModel + ModelTest::rowsInserted ASSERTion problem

白昼怎懂夜的黑 提交于 2019-12-08 02:06:01
问题 I'm trying to debug my model (QAbstractItemModel) with ModelTest. And I can't understand one assertion. There are two slots in ModelTest that intercept signals generated by my model. ModelTest::rowsAboutToBeInserted ModelTest::rowsInserted Slot/function 1 looks like this void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int end ) { Changing c; // ... c.last = model->data ( model->index ( start - 1, 0, parent ) ); c.next = model->data ( model->index ( start, 0,

Detect press and hold of a Button in QML

末鹿安然 提交于 2019-12-08 02:03:49
问题 I'd like to open a context menu when a user presses and holds a Button (I use Button for convenience). If I do Button { text: model.ualabel MouseArea { preventStealing: true anchors.fill: parent onPressAndHold: uaContextMenu.open() } ContextMenu { id: uaContextMenu MenuLayout { MenuItem { /**/ } } } } then the MouseArea responsible for pressAndHold steals all gestures even though and the Button cannot be clicked. What am I doing wrong? I'm using Qt 4.7 and importing QtQuick 1.1 and com.nokia

how to redirect Wheel events of QWidget to QTextEdit

强颜欢笑 提交于 2019-12-08 01:26:19
问题 when you turn the mouse wheel while the mouse is not on the QTextEdit ,the scroll bars will not move in such case ,but I still want to move the scroll bars by mouse wheel ,so how can I implement this function ? I know some software like Microsoft Word have this feature . I implement this feature like the following ,but when you move the scroll bars to the top or bottom by mouse wheel ,an error would occur : maximum recursion depth exceeded while calling a Python object. anyone can help ? my

QJSON using in Mac - getting some issues

落爺英雄遲暮 提交于 2019-12-08 01:16:13
问题 I am using the QJson for parsing. But I am stuck up with some issues. I have used the following code: void CityBook ::getCityList(QUrl url) { //!connect(cityReply, SIGNAL(readyRead()),this, SLOT(httpReadyRead())); cityGuideNetworkAccessManager = new QNetworkAccessManager(this); connect(cityGuideNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(httpReadyRead(QNetworkReply*))); QNetworkRequest cityRequest(url); cityGuideNetworkAccessManager->get(cityRequest); } void CityBook:

Qt4: while loop in seperate thread blocks GUI

≯℡__Kan透↙ 提交于 2019-12-07 23:01:46
问题 So I have a simple Qt4 application with a Start button, a Stop button, and a text field. When the Start button is pressed, a new thread is spawned that continually increments a counter (in a while loop), and the text field is updated to reflect this via signals/slots. When the Stop button is pressed, the counting stops, until the Start button is pressed again. It works ... sort of. It only updates the counter once per second; I want it to go faster, say 44100 times per second. Taking out the