qt4

Building optimized Qt4 - “./configure” flags and their meanings

余生颓废 提交于 2019-12-07 21:01:54
问题 I recently followed a discussion on the Qt4-interest mailing list about whether it is legal or not to build a commercial/proprietary application and statically link Qt4 into it. While there are some non-proven ways of doing so (by providing object files and a Makefile, etc. to the customer), it doesn't sound like such a good idea afterall. One of my projects is using the LGPL-licensed Qt4 libraries and I ship them as separate DLLs/Dylibs/so's to my customer, using a simple installer on all

How can I use Qt to get html code of the redirected page?

亡梦爱人 提交于 2019-12-07 19:26:45
问题 I'm trying to use Qt to download the html code from the following url: http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=nucleotide&cmd=search&term=AB100362 this url will re-direct to www.ncbi.nlm.nih.gov/nuccore/27884304 I try to do it by following way, but I cannot get anything. it works for some webpage such as www.google.com, but not for this NCBI page. is there any way to get this page?? QNetworkReply::NetworkError downloadURL(const QUrl &url, QByteArray &data) { QNetworkAccessManager

QGraphicsItem returns wrong position in scene. (Qt4.7.3)

青春壹個敷衍的年華 提交于 2019-12-07 17:11:20
问题 I have a QGraphicsRectItem item in a QGraphicsScene. The item is movable and has no parent . I place the item reading positions from file and calling the constructor: item = new QGraphicsRectItem (rect); that works. Positions are as intended. Then I try to store position back to file by getting it from the item using item->pos().toPoint() The position is wrong - not the absolute position in scene. The position is relative to the last position, where the item was created. Is pos() right method

Gui for KDE and Gnome [duplicate]

柔情痞子 提交于 2019-12-07 16:40:58
问题 This question already has answers here : Linux GUI development (4 answers) Closed 5 years ago . I want to write a gui to an application that is now CLI that needs to "look good" in both KDE and Gnome DE's, taking optimal advantage of a users settings for appearance. If I select Qt or GTK+ will I be able to do this? Do they integrate well with both DE's? Or does a KDE user need gnome libs and vice versa to run them? My development language of choice will be C++ 回答1: You can compile and link to

Using QUdpSocket to send datagrams

寵の児 提交于 2019-12-07 13:59:38
问题 I am trying to send a datagram using QUdpSocket. The following is the code I am using: udpSocket = new QUdpSocket(this); QByteArray datagram = "Message"; udpSocket->writeDatagram(datagram.data(), datagram.size(), QHostAddress::Broadcast, 45454); Now if I run this on a computer that has only one network adapter, it seems to work with no problem. However, if there are multiple adapters, I need to be able to control which is used to send the datagram. I have found that if I bind the socket as

How to pass X11 events to QDialog

青春壹個敷衍的年華 提交于 2019-12-07 13:54:37
问题 Currently, I am trying to pass system X11 events (on Linux) to an object I have created. To do this, I have installed an eventFilter onto my object from my QApplication. This works, in that it gets all of the events of the application. However I need to pass the object X11 events as well. I went ahead and created a x11Event in my object, hoping that it would receive events from X11, but this does not appear to be the case. Is there anyway to pass X11 events directly to my object, inside of my

Getting errors when using Qt Creator to create signals and slots

烂漫一生 提交于 2019-12-07 12:10:45
问题 I've created a new dialog using Qt Creator (version 4.7.0) - one of the templated forms (with an OK and a Cancel button). I want the user to enter some data on the form and then when they click OK, it saves that information. So I had a look, and saw that when the OK button is clicked, it sends and signal to the dialog's accept slot. So I right clicked on the dialog in the design view, and selected "Go to slot...". I clicked on the "accepted" option, which dropped an on_Dialog_accepted()

QTabWidget with CheckBox in title

孤街浪徒 提交于 2019-12-07 12:01:00
问题 I was wondering how to create (using PyQt4) a derived QTabWidget with a check box next to each tab title? Like this: 回答1: Actually I chose to only subclass QTabWidget. The checkBox is added at the creation of a new tab and saved to a list in order to get its index back. setCheckState/isChecked methods are intended to control the state of each checkBox specified by its tab index. Finally, the "stateChanged(int)" signal is captured and remitted with an extra parameter specifying the index of

Passing QUrl to a QNetworkRequest constructor causes “non-class type” compiler errors

可紊 提交于 2019-12-07 11:58:39
问题 when I'm passing a QUrl to a QNetworkRequest constructor I get strange errors form the compiler. It's even more strange that it happens only in a specific case, here's an example: #include <QCoreApplication> #include <QNetworkReply> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QString str; QNetworkRequest req(QUrl(str)); req.setUrl(QUrl(str)); // error: request for member 'setUrl' in 'req', which is of non-class type 'QNetworkRequest ()(QUrl)' QNetworkRequest req2(QUrl

Saving QPixmap to JPEG failing (Qt 4.5)

試著忘記壹切 提交于 2019-12-07 11:47:02
问题 I have the following code. QString fileName = QFileDialog::getSaveFileName( this, tr("Output Image file"), (""), tr("PNG (*.png);;JPEG (*.JPEG);;Windows Bitmap (*.bmp);;All Files (*.*)") ); if(fileName != "") { QwtPlot* pPlot = ... QSize size = pPlot->size(); QRect printingRect(QPoint(0, 0), size); QPixmap pixmapPrinter(size); pixmapPrinter.fill(Qt::white); { QPainter painter(&pixmapPrinter); pPlot->print(&painter, printingRect); } bool isOk = pixmapPrinter.save(fileName); if(!isOk) { QString