qt

Need to convert char* (pointer) to wchar_t* (pointer)

I am doing some serial port communcation to a computer controlled pump and the createfile function I used to communicate requires the com port name to be parsed as a wchar_t pointer. I am also using QT to create a form and aquire the com port name as a QString. This QString is converted to a char array and pointed to as follows: c...

QVarientMap _ Json Parsing in QT

I am using the following code for parsing. QJson::Parser parser; bool ok; QVariantMap result=parser.parse (cityReply->readAll(),&ok).toMap(); if (!ok) { qFatal("An error occurred during parsing"); exit (1); } foreach (QVariant city, result.toList()) { QVariantMap names = city.toMap(); qDebug() << "\t-" << names["name"]....

How to send mail via SMTP and get it by using Qt?

As I unserstand I should use QTcpSocket class in order to send a mail, and QTcpServer class in order to listen the connection and get the mail. But as I am a begginer in this area I need an example that demonstrates a simple transaction. Please give an example. ...

Should I Use Single Connection or Multiple Connections with QSqlDatabase

I have dependent and independent classes, I need to create database connections in these classes. As I understand from Qt documentation, if I create connections in default way, all of them use same connection. Should I create different database connections for different classes, or should I use same database connection. What are pros an...

PyQt ListView with groups

How can i create connection groups inside a QListView with PyQt. The group name should not be selectable. Example: http://www.shrani.si/f/T/bB/gSpSsYt/connectionlist.jpg :) ...

Undefined reference to a local class

Hello! I've just played with qjson library and got "underfinded reference" error. This is a code: #include <qjson/qobjecthelper.h> #include <qjson/serializer.h> class Person: public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(Gender gender READ gender WRITE setGender) Q_ENUMS(Gender...

How to resize an image in a QTextEdit?

How to click on the image, hold from a corner of it, and resize the image in the QTextEdit? Or at least how to get an image under cursor/that is selected in order to change width and hight? ...

What environment is more portable QT or java and which do you suggest using for my application needs?

I want to wrap a website and create an application around it (kind of like the iPhone/iPod Facebook app) and i want the application to be as portable as possible so with a very few modification to the code it can run on pc, mac, iPod, android or any other. I know that Java is known for it's portability but i dislike it and i don't know a...

Does Qt have a way to find bounding box of an image?

Given a .png image with a transparent background, I want to find the bounding box of the non-transparent data. Using nested for loops with QImage.pixel() is painfully slow. Is there a built-in method of doing this in Qt? ...

gdb error message: DW_OP_reg, DW_OP_piece, and DW_OP_bit_piece

I'm debugging somebody else's Qt program and ran into the following error message which I don't understand: DWARF-2 expression error: DW_OP_reg operations must be used either alone or in conjuction with DW_OP_piece or DW_OP_bit_piece. I'm not sure what that means and Google isn't of much help. Here's the context - sLocation is a QStr...

Problem with keyPressEvent on Nokia N97 Qt application

Hi Guys, I am stuck in the middle of this problem for a week or so now, I found a similar question posted on Qt for Symbian forum, but no body answered it. The problem is simply that when I run the application, well it is still not an application just a prototype :), either on the emulator or on a real device, and use the physical QWER...

QT mouse event handling problem

Greetings all, As seen in the picture I have an extended QWidget object (which draws the cell images and some countour data) inside a QScrollBar. User can zoom in/out the Image (QWidget size is changed according to the zoomed size of the QImage ) using mouse wheel. I process the events (mouseMoveEvent(),wheelEvent()..etc) by impleme...

Problem with declaring Metatype in Qt

Hello folks, I am trying to declare my Class as Metatype for Qt but figuring out some problems. It seems that after the MetaType declaration he wants to get access to a copy constructor or something like this which is explicitly not allowed for QObjects as I thought. This is my header: #include <QtCore/QObject> #include <QtCore/QMetaT...

problem in connecting qradiobutton and qtab widget

Hello Question i have more than 5 radio buttons in my software and i want that when i click a radio button then the text related to that button appears into the Qtab widget. but i tried a lot but when i click a radio button the text related to that radio button doesn't appear into the Qtabwidget. my header file v_lab.h is here...

screen orientation lock in qt

Hi! My question is about how to lock a screen orientation on WM using Qt? I know that I can use this code for Symbian: CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); TRAPD(error, if (appUi) { // Lock application orientation into landscape appUi->SetOrientationL(CAknAppUi::EAppUiOrie...

Zooming in/out on a mouser point ?

Greetings all, As seen in the pictures. I have QWidget inside a QScrollArea. QWidget act as a render widget for cell image and some vector based contour data. User can performe zoom in/out and what simply happens is, it changes the QPainters scale and change the size of QWidget size accordinly. Now I want to perform the zooming i...

Programmatically requesting elevated rights in Linux

(This question has identical title, but question body asks it in scripting point of view, e.g. su -c, don't dupe this to that) I have a Qt GUI app that needs to perform some file operations in /etc based on user input. One option would probably to use system() with sudo, but even that requires messing with sudoers file in some point. I ...

How can I add a static method to a QInputDialog for returning custom data?

QString QInputDialog::getText ( QWidget * parent, const QString & title, const QString & label, QLineEdit::EchoMode mode = QLineEdit::Normal, const QString & text = QString(), bool * ok = 0, Qt::WindowFlags flags = 0 ) [static] This function is defined to call a dialog get and return the text which will be inserted in ...

Qt interfaces or abstract classes and qobject_cast()

I have a fairly complex set of C++ classes that are re-written from Java. So each class has a single inherited class, and then it also implements one or more abstract classes (or interfaces). Is it possible to use qobject_cast() to convert from a class to one of the interfaces? If I derive all interfaces from QObject, I get an error due...

QChar to wchar_t

Hello, I need to convert a QChar to a wchar_t I've tried the following: #include <cstdlib> #include <QtGui/QApplication> #include <iostream> using namespace std; int main(int argc, char** argv) { QString mystring = "Hello World\n"; wchar_t myArray[mystring.size()]; for (int x=0; x<mystring.size(); x++) { my...