qt4

How to show QGLWidget in full screen?

假装没事ソ 提交于 2019-12-11 10:34:04
问题 I have a QGLWidget as part of the UI of my application. It is NOT a central widget , there are a lot of others widgets around it. I want to show it full screen on user clicks the button. Similar functionality like on youtube video flash player. I have tried to use showFullScreen with no effect. I have read how-to-fullscreen-a-qglwidget and fullscreen-widget, but they suggest using showFullScreen. Qt documentation states that for using showFullScreen widget must be an independent window. So I

Windows, Mingw Qt Application Does Not Run On Deployed Computers

柔情痞子 提交于 2019-12-11 10:05:29
问题 I have created a Qt application with Mingw. The application runs properly on the development computer after copying the required DLL's to the directory. However, when deploying on external computers, the application does not run at all. Update: In addition, the application uses Sqlite3 via QtSql. 回答1: It's quite likely you're still missing some dll. Check the Windows event log for any errors after running the application. (Administrative Tools->Event Viewer). Try launching the application

Custom sorting method of QTableView?

落爺英雄遲暮 提交于 2019-12-11 09:28:48
问题 How can I setup custom sorting method for a QTableView , or for the model ? (Which function should I re-implement) The default sorting algorithm are for strings , I want a number sorting method for some specific column. Thanks. 回答1: You should use QSortFilterProxyModel. You should reimplement lessThan method. Then you have to set sourceModel for your proxy model, and set your proxy model as model for your view class MyProxyModel: public QSortFilterProxyModel { protected: bool lessThan ( const

matplotlib QtDesigner widget on Mac?

纵饮孤独 提交于 2019-12-11 08:57:53
问题 is there a matplotlib widget plugin for QTDesigner available for the Mac? Why I care: I'm trying to GUI-ify an existing python/matplotlib/scipy/numpy application. I'd like to try to do this via QT and Qdesigner, but I'm new to them. I know I can implement the GUI apart from Designer "by hand" and have benefitted from "Chapter 6. Embedding Matplotlib in Qt 4" (from the book Matplotlib for Python Developers), and posts such as "http://eli.thegreenplace.net/2009/01/20/matplotlib-with-pyqt-guis/"

Qstring replace is not working fine

时光总嘲笑我的痴心妄想 提交于 2019-12-11 08:17:22
问题 i want to replace temp.replace (QString("/"), QString("\")); Here i am getting error error C2001: newline in constant error C2275: 'QString' : illegal use of this type as an expression How can i replace "/" with "\" thakns 4 ur answer. But till now i didnt sort my issue. Please check my code // Convert to a wchar_t* size_t origsize = strlen(toChar) + 1; const size_t newsize = 100; size_t convertedChars = 0; wchar_t wcstring[newsize]; mbstowcs_s(&convertedChars, wcstring, origsize, toChar,

Qt support for coloring SVG in a QIcon

那年仲夏 提交于 2019-12-11 07:57:16
问题 It appears that Qt doesn't support the stroke/fill options on the path tag within a SVG: <svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"> <path fill="green" stroke="red" d="M2 0c1 2-2 3-2 5s2 3 2 3c-.98-1.98 2-3 2-5s-2-3-2-3zm3 3c1 2-2 3-2 5h3c.4 0 1-.5 1-2 0-2-2-3-2-3z" /> </svg> I load this into my application via Qt's resource loader, using a QIcon: QIcon icon(":/svgs/fire.svg"); It displays as black on white regardless of the SVG properties. When I open the

Starting a Qt drag operation on X11 w/ OpenGL causes screen flicker

ぐ巨炮叔叔 提交于 2019-12-11 07:38:50
问题 I've got a Qt application running on X with -graphicssystem opengl as a command line arg. Whenever I start a drag and drop operation (via QDrag::exec() , using native cursors and no custom drag pixmap), the screen flashes briefly with vertical stripes of what seems to be garbage data from the display buffer. The application occupies the entirety of the touchscreen it displays on, and hence we aren't using a compositing window manager (though I get the same issue running from fluxbox). The

How to change the background of a text bloc in a text document in Qt

主宰稳场 提交于 2019-12-11 07:32:47
问题 is there a way to change the background color of a QTextBlock in a QTextDocument without using a subclass of QAbstractTextDocumentLayout. I have tried many ways and the effects are null. I am trying from the textCursor() method of a QPlainTextEditor and it seems practically everything is const. 回答1: You could try the merge methods: QTextCursor cur = edit->textCursor(); QTextCharFormat fmt; fmt.setBackground(QBrush(Qt::gray)); cur.mergeBlockCharFormat(fmt); 回答2: Could this example help you ?

Initilizing value for a const data

心已入冬 提交于 2019-12-11 07:25:20
问题 Following code is in my c++ class static const QString ALARM_ERROR_IMAGE ; i want to initilize ALARM_ERROR_IMAGE = "error.png"; Is it possible to initilize error.png to static const QString ALARM_ERROR_IMAGE Want to keep it inside class 回答1: Static variable of a class have to be defined explicitly in the namespace scope only once (irrespective of wheter they are further cv qualified or not). In the .cpp file (e.g in <ClassName>.cpp ), in the global namespace (assuming your class is in global

PyQt how to add link to QTextBrowser

喜欢而已 提交于 2019-12-11 07:19:52
问题 I don't know why I'm having such a hard time finding this, but how do you add a hyperlink to QTextEdit or QTextBrowser ? I'm trying to make something that has a list of links and when you click on a link you get the object that the link is referencing. 回答1: You need to set the acceptRichText property to true. Then you can just pass in HTML using the setHTML() slot. win.setHTML("<a href="http://foo>Bar</a>"); 来源: https://stackoverflow.com/questions/10134107/pyqt-how-to-add-link-to-qtextbrowser