qt4

cmake doesn't link libGLU using QtOpenGL

孤者浪人 提交于 2019-12-12 19:42:22
问题 I'm trying to compile a software that uses QtOpenGL, but I got a link error because -lGLU is not present. cmake is used. The only relevant line in CMakeLists.txt files seems to me find_package(Qt4 REQUIRED) The system is Linux 64bit, Debian unstable, qt version 4.7.3, cmake version 2.8 回答1: GLU is neither part of OpenGL nor Qt. You must add it as an additional dependency manually; the CMake FindOpenGL module also searches for GLU % cmake --help-module FindOpenGL cmake version 2.8.1 FindOpenGL

Display a form in Qt

最后都变了- 提交于 2019-12-12 18:36:21
问题 This should be very easy. I'm using Qt Creator and I have made a Qt Gui Application (That had main.h , main.ui and main.cpp ) I just created a Qt Designer Form Class that also has a header file, ui, and a class. I have made an action inside my main.cpp called ShowSecondForm : void Main::ShowSecondForm() { } Everytime I execute ShowSecondForm(); I want the second form to be displayed. What do I put inside so my form will open? Also, is is possible to pass a string to the form while opening it?

Animate using a pixmap or image sequence in Python with QT4

时间秒杀一切 提交于 2019-12-12 18:32:59
问题 I have a small Python script that makes a transparent window for displaying a graphic on screen and I'd like to animate that graphic, but am entirely unsure how or where to even start. Here's what I do have at least: import sys from PyQt4 import QtGui, Qt, QtCore class Transparent(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.setAttribute(Qt.Qt.WA_NoSystemBackground) self.setAutoFillBackground(True) pixmap = QtGui.QPixmap("test1.gif") pixmap2 = QtGui.QPixmap("test2.gif

When dragging a row in a QTableWidget, how can I find out what row index it was dragged FROM and TO?

被刻印的时光 ゝ 提交于 2019-12-12 18:18:55
问题 I'm trying to keep some array data synchronized with the contents of a QTableWidget. I'd like to enable drag and drop reordering (moving items within the table, as opposed to copying), but it's not clear to me how, when the drop event is fired, I can find out what index the item was dragged FROM. Hence, I have no way of knowing what object to move within the list I'm synchronizing with. How can I get the original row index of the item being dragged? 回答1: Encode the from index in QMimeData and

Get list of points affected by drawLine() or QLineF

五迷三道 提交于 2019-12-12 17:49:42
问题 How do I get a list of points/coordinates that the drawLine() function affects? For example if I have QLineF line(10.0, 80.0, 90.0, 20.0); QPainter(this); painter.drawLine(line); I want to get the list of QPoint coordinates that the drawLine() will draw. I'm aware of Bresenham's line algorithm, however I need this to work in a more general case where I can set different QPen and QBrush: painter.setPen(QPen(myColor, myWidth, Qt::SolidLine, Qt::RoundCap)); I also need it to be consistent with

how to use default icons with qt

瘦欲@ 提交于 2019-12-12 15:42:41
问题 I'm using only Qt (though PyQt) and I don't get icons when I call e.g. QMessageBox.warning(). Is there a way to use the platform's default icons? Currently I'm using the more complete QMessageBox constructor and calling setIconPixmap. 回答1: http://doc.qt.io/qt-5/qmessagebox.html from the above link: QMessageBox supports four predefined message severity levels, or message types, which really only differ in the predefined icon they each show. Specify one of the four predefined message types by

Qt QListWidget performance issues

拥有回忆 提交于 2019-12-12 14:41:29
问题 my application (Qt 4.6) requires me to display certain messages in a list which always scrolls down upon adding a new line (so the most recent line is always visible). As I am having performance issues in the whole process which includes displaying these one-line messages, I've run some tests and found the QListWidget I am using for this to be the main issue. I've created a simple test project with a default list widget "listWidget" and a push button "pushButton" which adds 1000 items in a

Problem in Moving QTextCursor to the End

元气小坏坏 提交于 2019-12-12 14:12:45
问题 I'm trying to implement a simple text search in an editor i'm writing. Everything have been fine until this problem! I'm trying to implement a backward search here. The procedure is: look for the subject backward, if not found, beep once, and if find button was pressed again, go to the end of the document, and do the search again. "reachedEnd" is an int, defined as a private member of the editor class. Here's the function that does the backward search. void TextEditor::findPrevPressed() {

MAKEFLAGS in Qt Creator via .pro project file

无人久伴 提交于 2019-12-12 13:27:42
问题 The PC I'm using has 4 cores so I wanna use all them while compiling, which I do by passing the -j4 option to the compiler. In Qt Creator I do that by adding an environment variable in the Build Environment panel, as shown in the images: MAKEFLAGS = -j4 The problem is that this setting doesn't persist across all projects in the PC I'm using, which will be cool. So I have to do that for each project at least once. I think this is stored in the .pro.user file, since every time .pro.user gets

PyQt4: get list of all labels in QListWidget

倾然丶 夕夏残阳落幕 提交于 2019-12-12 13:16:57
问题 I am new to PyQt4 and especially the QListWidget. I am trying to get a (Python) list of of all labels currently displayed in the QListWidget. I'm able to to get a list of all the QListWidgetItems, but I'm not sure how to get to the labels from there... This is what I use to get the list of all the QListWidgetItems: items = [] for index in xrange(self.ui.QListWidget.count()): items.append(self.ui.QListWidgetitem(index)) Thanks for your help! 回答1: .text() returns the text within a