Quantcast
Channel: Jobs
Viewing all 18427 articles
Browse latest View live

QString's implicit sharing - how does it work, so I can know when I should be benefitting from it.

$
0
0
I have a whole heap of code that spends a significant amount of time constructing and destructing QStrings. No worries, thought I; I happen to know that many of those QStrings are actually the same, so I can eliminate all the unnecessary copies of them. Then I found that QString is already implicitly shared, so I thought that it already should be using just one copy of each different QString, but that doesn’t seem to be happening. Does anyone know more about the QString implicit sharing than the docs explain? For example, how about this: QString alpha("Beans"); QString beta("Beans"); Those will be shared data, I expect. So how about this as well QString gamma("Eggs"); gamma = "Beans"; So I made another QString, gamma, that began life completely different, and then changed it so it’s the same as an already existing QString. So will THAT now be shared data? And then how about gamma = alpha; That surely should now be shared, even if it wasn’t before? And other questions; is it ALL QStrings over the entire process, or is it more restricted – perhaps by class, or translation unit, or some other such? And how about static QStrings, and ones I make on the heap, and ones in the stack, and temporaries that never even have a name? I really just need to know much more about how it works so I can work out if my code is, or should be, getting the benefit of it of not. Does anyone have information that can help fill in the gaps?

QAbstractItemModel - Am i doing it right?

$
0
0
Hi I have just started with QAbstractItemModel and have some doubts as to whether I am doing things in the correct way. I have class that (amongst other things) is storing a set of data that I want to display in a QTreeView. So I made a model class derived from QAbstractItemModel and have then attached this model to my QTreeView which does show the data correctly and allows the user to edit the values. As expected when an edit is completed my setData method gets called and I can set the relevant items data. However, this does not update the underlying data and I am struggling to see how this is done. I would be grateful if someone could a) confirm that I am doing things correctly b) explain how the underlying data is typically updated Thanks

uaktualnienie modelu z watku

$
0
0
Witam, Pisze aplikacje ktora odbiera dane z sieci (przesylane jest cos w rodzaje struktury katalogu) nastepnie laduje te dane do modelu, sprawdzajac czy juz taki wpis tam istnieje czy nie. Chcialbym przeniesc teraz aktualizacje tego modelu do watku zeby nie blokowac GUI. Moje pytanie brzmi jak moge to zrobic, czy moge przeslac pointer do modelu i zalozyc mutex-y w calym modelu ale czy nie zniszczy to wydajnosci ? Nie wiem jaka bedzie odpowiednia droga do akutalizacji modelu poniewaz duzo bedzie takich danych przesylanych i chcialbym zeby to wszystko dzialo sie w innym watku.

Sniffer without libpcap

$
0
0
Hi, I want to build a test sniffer that works in Windows/Mac/Linux. Because I want to be able to run without installing it, I can’t use libpcap. Is there a way to put a NIC in promiscuous mode using the Qt Library?

Parsing XML vs JSON (best one to use?)

$
0
0
Hi, I have a web service that return XML data for now. I then parse this result with the class “QXmlStreamReader”. I heard a lot of praise on JSON, is it worth it to modify my web service so that it return JSON data instead of XML? I have some method from my web service that returns ~200 elements, each element with ~40 tags to parse (so approx 8000 fields to parse and put in Qt object. Is there a real benefit of switching to JSON with QT? Example of my current parsing code that retrieve user info from DB (this one is lightweight) :  QByteArray arrayData =  reply->readAll();     qDebug() << arrayData;     QXmlStreamReader xml(arrayData);       /// Modify global user properties     XmlUtil::createUserFromXml(xml);   void XmlUtil::createUserFromXml(QXmlStreamReader& xml) {       int id = 0;     QString username;     QString password;     QUuid session_id;     QString first_name;     QString last_name;     QDate birthdate;     QChar sex;     QString email;     QString last_ip;     QDateTime last_login;     double weight;     double height;     int FTP;     int LTHR;     int KM_done;         while(!xml.atEnd() && !xml.hasError())     {         /* Read next element.*/         xml.readNext();         if(xml.name() == "id") {             id = xml.readElementText().toInt();         }         else if(xml.name() == "username") {             username = xml.readElementText();         }         else if(xml.name() == "password") {             password = xml.readElementText();         }         else if(xml.name() == "first_name") {             first_name = xml.readElementText();         }         else if(xml.name() == "last_name") {             last_name = xml.readElementText();         }         else if(xml.name() == "birthdate") {             birthdate = QDate::fromString( xml.readElementText(), "yyyy-MM-dd");         }         else if(xml.name() == "sex") {             sex = xml.readElementText().at(0);         }         else if(xml.name() == "email") {             email = xml.readElementText();         } //        else if(xml.name() == "last_ip") { //            last_ip = xml.readElementText(); //        } //        else if(xml.name() == "last_login") { //            last_login = QDateTime::fromString(xml.readElementText(), "yyyy-MM-dd hh:mm:ss"); //        }         else if(xml.name() == "weight") {             weight = xml.readElementText().toDouble();         }         else if(xml.name() == "height") {             height = xml.readElementText().toDouble();         }         else if(xml.name() == "FTP") {             FTP = xml.readElementText().toInt();         }         else if(xml.name() == "LTHR") {             LTHR = xml.readElementText().toInt();         }         else if(xml.name() == "KM_done") {             KM_done = xml.readElementText().toInt();         }       }     User *user = qApp->property("User").value<User*>();     user->setData(id, username, password, session_id, first_name,  last_name,                           birthdate,  sex, email, last_ip, last_login,                           weight,  height,  FTP,  LTHR,  KM_done); }

[Linux] Building Qt-Creator with static Qt libraries

$
0
0
hi guys I would like to build Qt-creator from source, and use the static compiled libraries of Qt. Is this possible ? I have compiled the Qt libraries as static without any trouble with the following: ./configure -static -release -opensource -developer-build --confirm-license -rpath -nomake tools -nomake examples -nomake demos -no-webkit -no-scripttools -no-script Now i want to compile Qt-Creator using those static libraries. However, i have multiple errors on build since the program tries to look for uninstalled features such as Qtscripts: json.cpp:38:25: error: QScriptEngine: No such file or directory According to my Qt settings, how am I supposed to compile Qt-creator to get it to work ? Thanks

mousePressEvent called twice on touch devices

$
0
0
Hello, I get in some trouble when I´m using mousePressEvent(QGraphicsSceneMouseEvent* event) with a touch input device. The event is called twice when touching once. If im clicking once with my default mouse the event is only called once (like it should be). Any suggestions? Thanks and regards.

Erro with qt quick(no show correctly)

$
0
0
I wanted create a applicantion with qt quik, but I can not run….he show a window transparent….. I read some about ANGLE, but do not know what to do…. Has anyone had this problem? How to solve this?

Choosing QT vs. Objective-C/IOS

$
0
0
I have a strong background in C/C++, however, I just started learning objective-C and making good progress. My question is should I switch to learning QT instead of objective-C ? I know the pros and cons about learning/using QT, i.e. it can be used for both Android and IOS. I’m a little hesitant and don’t want to devote a lot of time if it could be spent elsewhere. Then again, I do not want to completely abandon my C++ skills either. I personally don’t always have a lot of free time to begin with. Some words of wisdom would be greatly appreciated.

xml xsl to generate excel.xml file failing.

$
0
0
Hi folks, I have a xsl file which transforms the xml to an Excel XML. It works using the Mac xslt processor and the one in C#. It does NOT work w/ Qt’s xmlpatterns, or xmlpatternsvalidator. It complains: No definition for element {http://www.w3.org/1999/XSL/Transform}xsl:stylesheet available. Does anyone know what am i doing wrong? Is Qt’s xmlprocessor able to transform xml to excel. I am not doing anything to fancy. I gotta believe this can be done. Here is the line it complains on. What is this nubee doing wrong? TIA xmlns:ss=“urn:schemas-microsoft-com:office:spreadsheet” <?xml version=“1.0” encoding=“utf-8”?> <?mso-application progid=“Excel.Sheet”?> <xsl:stylesheet version=“1.0” xmlns:html=“http://www.w3.org/TR/REC-html40” xmlns:xsl=“http://www.w3.org/1999/XSL/Transform” xmlns:o=“urn:schemas-microsoft-com:office:office” xmlns:x=“urn:schemas-microsoft-com:office:excel” xmlns:ss=“urn:schemas-microsoft-com:office:spreadsheet”>

Taking Screen shot in devices without x server

$
0
0
Hi, I am working on a Linux base Intel board. The kernel is built without frame-buffer and there is no /dev/fb0 file. The project i am working on is to take screen shot the display. The main UI application is a Qt based browser. and it uses OpenGL for rendering. My aim is to have two application, One the browser and another application. The browser displays UI in the screen(Which is already present) The second application should take screen shot of the browser application and save it as .png image. Is there any way to take the screen shot. The device doesn’t have a X-server. Is there any API to reade directly from the display device / frame-buffer in Qt of another application? I have already tried the screenshot application it didn’t work for me. Thanks in advance.

Write and read xml file example

$
0
0
I am looking for a minimal example to read and write xml file, but the only one [developer.nokia.com] I found does not work. Can you show me a more recent example? Thanks in advance :)

How can I set the background color for QPushButtons and QCheckBoxes?

$
0
0
I’m trying to change the background color of a QAbstractButton (either a QPushButton or QCheckBox) in Qt5 and having zero luck. This does nothing: pButton->setAutoFillBackground(true); QPalette palette = pButton->palette(); palette.setColor(QPalette::Window, QColor(Qt::blue)); pButton->setPalette(palette); pButton->show(); and if I try changing the style sheet: pButton->setStyleSheet("background-color: rgb(255,255,0);"); then Qt throws up its hands and draws an afwul-looking blocky button. There is a page titled “How to change the background color of QWidget” but it just talks about those two methods. There is also a page “Qt Style Sheets Examples” that implies that if you want to change the background color, you have to take over all aspects of drawing the button, which just seems like overkill. I need this to run on Mac, Windows, and Ubuntu Linux, and it’s really not a happy thing if I have to manually draw everything about the button 3 times (once for each platform). Am I missing something obvious?

Rebooting the Qt Ambassador Program

$
0
0
Hi, As I stated a while back I’ll start making noise around here. I’m the still fairly new online community manager from Digia. One of the things I’d like to do as my first tasks is to ‘reboot’ the Qt Ambassador Program. By a reboot I mean to start the program again in some form that stays true to the idea of the original ambassador program, yet brings it more to today. My thinking is that we should have different kind of ‘ambassadors’ for the community. For example we could have a title for people who actively help here on the forums. People like for example SGaist show a spirit of helping and guiding others that is very much what this community is about. Also active wiki editors/maintainers/gardeners could have a title. Bug hunters/triagers as well and of course people who make stunning cross platform applications with Qt. And quite possibly other types of activity that merit wider recognition. The number of ambassadors (or whatever the titles would be) would be limited to a fairly small number. Also the titles would be for a limited time (annual?), with the potential of being granted the title for life if one achieves the title several years in a row. Thoughts. comments, ideas all welcome to this thread! I’ll make a wiki-page once this is a bit more concrete. Also the name for the program is still in the air, all suggestions are welcome :)

outlook message from clipboard

$
0
0
Hi guys, I searched alot and die not find a solution. How can I get a mail from outlook by drag and drop or over the clipboard into my applications? I get all mime formats and a summary,but no message body vor attachments Can anybody help me? Erni35

How to improve the site?

$
0
0
Hi, I’ve now been looking around, having discussions and wondering about things, and have now come to some form of understanding on what should be done with the site. The things I’ve read on the wiki about the ideas that have been put down for the future of the site [qt-project.org] pretty much ring true to me. Looking at the infrastructure there are a number of actions that need to be investigated and taken: Moving the wiki to the MediaWiki that is currently running at wiki.qt-project.org [wiki.qt-project.org] (yes, I was just as surprised as anyone to find it there. It is locked at the moment, but it’s there) Cleaning the current userbase, there are user ids that have not been used in a long time. Cleaning needs to happen to make other actions possible Moving the userbase to the Atlassian tools that are running and in use for bugreports and codereview Moving the static pages like the documentation to another CMS (WordPress comes to mind with it’s large and active developer base) Moving the forums to another platform (if WordPress for the static part, then bbPress would be a natural choise, but that needs a discussion) This task is actually pretty big, because we need to preserve the history. Also this needs to happen at the same time as the userbase move, or it needs to be co-ordinated with it. As you can see the theme here is moving away from expression engine. The current install is pretty hacked in every corner, and with the original developers gone, there are things that can not be updated without a prohibitive amount of work. That is part of the reason I have been closing old bugs, with the current platform there is fairly little that can be done easily. Having task specific tools for each part of the site (wiki, static pages, forum) should also provide a better possibility for anyone to advance to maintain some aspect of the site (compare with the current problems in giving out moderator rights) Of course I can’t just do this straight away, I need to convince people inside Digia that this change is necessary, and worth the effort. But I do believe that things need to be changed in order to make the services here on qt-project.org more accessible to everyone. So consider this a task list that I’ll start to chew on. If you see anything that should be changed, added, not touched, removed, please say so. I’ll write a wiki page and start to detail what tasks are necessary to make all this happen.

calling slots between classes where one class is not the parent

$
0
0
Hello, I am wondering how I can call a slot from a different class when the class with the slot is not necessarily the parent. I have a bunch of classes that have parents in this order: mainWindow—>mainWidget—>tabWidget—>browseTab. basically mainWindow is the parent of mainWidget which is the parent of tabWidget, etc. How can I have a button in browseTab, that, when pressed, calls a slot in mainWindow. I know how to make it call a signal in its parent class (tabWidget), but I am stuck on how to make it call a slot in its ‘grandparent’ or ‘great grandparent’ classes. Thanks!

setting the URL when a new tab is made

$
0
0
Hello everyone, I am having some trouble (like always) with my browser. My browser has a class named mainView and another called browseTab. mainView contains a QTabWidget that contains a browseTab. browseTab contains a QWebView called webView. in my mainView class I have a slot that adds a new tab: void mainView::newTab() {     tabWidget->addTab(new browseTab(this), tr("Search")); } the newTab() slot is called from within browseTab, this works fine, but I would like to have another parameter when creating a new browseTab. I would like to be able to specify the URL of the webView inside the browseTab. Something like: void mainView::newTab() {     tabWidget->addTab(new browseTab(this, 'URL'), tr("Search")); } This way I can call the newTab slot and create a new tab with a browseTab containing a webView that automatically loads a certain URL. here is the constructor for browseTab: browseTab::browseTab(QWidget *parent) :     QWidget(parent),     mainView_object_pointer(parent) And here is where newTab() is called from within browseTab: connect(NewTabAction, SIGNAL(triggered()), mainView_object_pointer, SLOT(newTab())); I would like it so that I can specify a URL in the connect() function (located in browseTab) and have it create a new tab with a specific URL. code solutions would be great! Thanks!

Convert from custom type to string

$
0
0
Hi. I’m register converter for my type, but in qml I get error: Error: Cannot assign QObject* to QString. C++ ... QString convert( const IServer* srv ) {     return srv->name(); } ... qmlRegisterUncreatableType<IServer>( "plugin", 1, 0, "IServer", "" ); ... QMetaType::registerConverter<IServer*, QString>( convert ); Is it possible convert my type to string in qml?

WSOD (White Screen Of Death) problem if app is installed from the play store.

$
0
0
If you install an application from the play store it places the app in the app drawer and on the main screen. If you start the app from the main screen then dismiss it you can recall it by tapping on the main screen icon a second time. If you try recalling the app by clicking on the icon in the app drawer after starting the app from the main screen you get the app to open but everything is white. From this point you must close the app and restart it. If you remove then replace the main page app from the app drawer the app works as expected and the WSOD is fixed. After you fix this you can update the app and the fix is still good. There is some kind of disconnect between the two icons on install. I have verified that this is not just a problem with our app and the play store but also Digia. If you install the Hangman or the Quick Forecast app you will see it too.
Viewing all 18427 articles
Browse latest View live