qt4

How to draw a QPoint on a QGraphicsView/Scene

左心房为你撑大大i 提交于 2019-12-12 05:58:36
问题 It's really not clear to me how to simply draw a 2d point in QT. I want it to overlay a QPixmap item, but every piece of documentation I find talks about drawing polygons with brushes. Thanks in advance - 回答1: From Qt's documentation: QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen. So if you have a QPixmap, convert it to QImage and then use QImage::setPixel: QImage image = pixmap-

How the Qt source code is organized

天涯浪子 提交于 2019-12-12 04:58:39
问题 I am trying to find the Qt implementation for QLinkedList::operator+( const QLinkedList<T> &list ) , but I can't make sense of the Qt source code. This is part of Qt 4.8.4: I found the declaration in the .h: QLinkedList<T> operator+(const QLinkedList<T> &l) const; But in the .cpp all I see is this: /*! \fn QLinkedList<T> QLinkedList::operator+(const QLinkedList<T> &other) const Returns a list that contains all the items in this list followed by all the items in the \a other list. \sa operator

Is it possible to have existing C++ code work with Qt?

五迷三道 提交于 2019-12-12 04:58:23
问题 I am new here. I am a beginner in Qt but i am an intermediate level programmer in c++. I had written a program previously in C++ and STL(No code is platform dependent and whole program is broken into around ten .cpp/.h files). Now if I develop A Gui in qt,can I link it to my old program or should I rewrite everything? For instance I use file IO using fstream. But in Qt I see there is QFile so is it possible to link it. The program is pretty lengthy. So it will be very hard to rewrite

QTabWidget with multiple line?

戏子无情 提交于 2019-12-12 04:47:51
问题 Is it possible to make QTabWidget behave like windows system , use multiple line when there's just too much tabs ? I checked qt's doc , seems no such thing was available. 回答1: You would need to subclass QTabWidget or Widget and implement this functionality yourself. I would recommend that you consider a different approach if you plan more tabs than will conveniently all fit in a single line (without arrows or multiple rows). Tabs on multiple rows, although common enough, are widely considered

Extract specific string

早过忘川 提交于 2019-12-12 04:33:54
问题 I have the following QString that I want to extract only the access_token value which is "http%3a%2f%2fschemas.xmlsoap....." How to do that? {"token_type":"http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0","access_token":"http%3a%2f%2fschemas.xmlsoap.org%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=asdasr21321214a%2f%2fschemas.microsoft.com%2faccwresscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=https%3a%2f%2fdatamarket.accesscontrol.windows.net%2f&Audience=http

Converting Qt compliant C++ to ui XML(QtDesigner) format:

倖福魔咒の 提交于 2019-12-12 04:28:59
问题 I have C++ widget code that was generated by QtDesigner (Qt open source v 4.7.3, using the Form->View Code menu in QtDesigner). I have modified that code in a manner that is entirely Qt compliant - just hand coded a few more signals, slots and wigdets based on the patterns of the generated code - code runs perfectly when built with Code::Blocks. Now I'd like to convert my modified C++ source back into the ui XML format that QtDesigner uses. I'm looking for a quick way of doing that (Win7-32

mupdf: how to put a fz_pixmap into Qt4 QPixmap

大憨熊 提交于 2019-12-12 04:28:12
问题 I am trying to exploit mupdf library (Qt4 app). I have taken some code from pdfdraw.c. I was able to create a pixmap (fz_pixmap) from a pdf page. Now I need to display the pixmap. It is likely I can use QPixmap but I ask how to do so. 来源: https://stackoverflow.com/questions/7417994/mupdf-how-to-put-a-fz-pixmap-into-qt4-qpixmap

win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d

流过昼夜 提交于 2019-12-12 04:08:00
问题 While studying the Plug & Paint Example I got stuck at the project file, more specifically at the following: LIBS = -Lplugins -lpnp_basictools if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d } What this peace of code does? What's $$member(LIBS, 0) ? Since I'm on Windows, just doing if(!debug_and_release|build_pass):CONFIG(debug, debug|release) win32:LIBS = $$member(LIBS, 0)

Profile Settings for QTsettings

微笑、不失礼 提交于 2019-12-12 03:49:02
问题 I have a profile which consists of Method names and its relation between each profile void Method::loadFrom(Settings &set, bool ownGroup) { Settings s("profiles.ini"); s.beginGroup("Profiles"); foreach (const QString &group, s.childGroups()) { s.beginGroup(group); Profile *profile = new Profile(); profile->setObjectName(group); profile->load(s); s.endGroup(); m_currentProfileManager->m_Profiles << profile; } EraObject::staticLoadFrom(set, this, ownGroup); } void Method::saveTo(Settings &set,

c++ inheritance Qt problem qstring

时光怂恿深爱的人放手 提交于 2019-12-12 03:45:37
问题 I have this following code: template <class T> bool loadCSV (const QString &filename, map<T,int> &mapping){ QFile boxfile; boxfile.setFileName(filename); QString line; QStringList list; if (!boxfile.open(QIODevice::ReadOnly)){ cout << "Could not open box data file." << endl; return false; } QTextStream stream2( &boxfile ); while (!stream2.atEnd()){ line = stream2.readLine(); list = line.split(','); mapping[list.front().toInt()]=list.back().toInt(); } return true; } It takes a CSV file and