Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • Printing html QTextDocument prints images wrong...

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Unite and split files.

    2
    0 Votes
    2 Posts
    1k Views
    JeroentjehomeJ
    I would recommend reading the QIODevice class documentation. In that class all file related options are described. You might want to use the .pos and .count etc to get all the parameters you need. Then think of a way to have a sort of MBR in the beginning of the file which lists the current files imported and what position the data bytes of the file are. greetz
  • 0 Votes
    6 Posts
    8k Views
    D
    @alexisdm thank you very much, your post saved me :)
  • Transfering QTextDocument's contents to another

    3
    0 Votes
    3 Posts
    1k Views
    H
    I'm not trying to clone the document but to insert all its content into another. For example : Let's assume that the first document is structured as follow : @ <Document1> <RootFrame1> <Block1 /> <Frame1 /> <Table1/> <Frame2 /> <Block2 /> ... </Document1> @ and the second one : @ <Document2> <RootFrame2> HERE WILL INSERT ALL THE CONTENT OF THE FIRST DOCUMENT </Document2> @ After transfering contents, the second document shall look like : @ <Document2> <RootFrame2> <Document1> <RootFrame1> <Block1 /> <Frame1 /> <Table1/> <Frame2 /> <Block2 /> ... </Document1> </Document2> @
  • Signal slots question

    7
    0 Votes
    7 Posts
    3k Views
    sierdzioS
    Damn, I do sound quite arrogant at times :( Sorry. But I really mean it with reading the documentation.
  • Extending QtMultimedia to support streams over a new protocol

    6
    0 Votes
    6 Posts
    5k Views
    A
    Well, perhaps you are thinking of something like KDE's KIO?
  • Develop new Qt GUI controls

    5
    0 Votes
    5 Posts
    3k Views
    V
    This link may be useful as well - "Creating Custom Widgets for Qt Designer":http://qt-project.org/doc/qt-4.8/designer-creating-custom-widgets.html
  • Battery status Problem

    10
    0 Votes
    10 Posts
    5k Views
    G
    Hi, your compile error showed up in the mainwindow.h file, so I removed all things that were not related to that :-)
  • Problem Displaying QByteArray Binary String as Hex String in qDebug

    3
    0 Votes
    3 Posts
    22k Views
    C
    Oh dear, another person confused by the difference between a number and its representation as a string. Your binValue QByteArray contains a string of 16 characters (bytes) that read to a human as the binary representation of the number. Converting those 16 bytes to 32 hexadecimal characters (your line 10) is nothing like the same thing as displaying the original number in hex. Converting those 16 characters to a number by treating it as if it were a hexadecimal representation (your lines 12/13) will not give you the original number and, in general will overflow an int... ok == false and return is 0. If you want value converted to a hex string then just ask for it that way: @ int value = 65494; // the original number (it is in binary in memory) qDebug() << QString::number(value, 16); // displayed as a hex string // Converting a hex string back to a number bool ok; int value = QString("FFD6").toInt(&ok ,16); qDebug() << value << ok; @
  • How can I substitute one key_character for another?

    9
    0 Votes
    9 Posts
    3k Views
    D
    QtTest module is designed to assistant you to test your application. @ QT += testlib @ But don't use this module in normal application in other cases. In addition, d2uriel and Volker had told you how to do.
  • Save treeview item

    6
    0 Votes
    6 Posts
    3k Views
    K
    Thanks, I know, it is not necessary.
  • [Solved] Problem with creating new File!!!

    10
    0 Votes
    10 Posts
    19k Views
    V
    suggestion, check the return from your QFile::open(). That can tell you if your file actually opened correctly... @ QFile file(QString(file_name).append(".txt")); qDebug() << "File location: " << QString(file_name).append(".txt"); if (!file.open(QIODevice::ReadWrite | QIODevice::Text)){ qDebug() << "File open failed"; return -1; } QTextStream stream(&file); stream << "Create Document"; QTextStream(stdout) << this->file_name; //To see the name of the file, which has just been typed file.close(); return 0; @
  • How to run Qt application from windows commandline?

    11
    0 Votes
    11 Posts
    12k Views
    V
    if you have all the required libraries in the directory, including the Qt dll's for your library, then you can just use the explicit path to run your application (unless you have a Qt license and built it statically, then you dont need the dll's)... c:\path\to\your\application\file.exe
  • How to restrict the number of attempts in a login form ?

    4
    0 Votes
    4 Posts
    2k Views
    JeroentjehomeJ
    Hmm, if I make a suggestion is to not have the D1 (I presume a dialog) start a new dialog (D2.exec), but rather have the D1 be started by the parent, wait for it to be closed or accepted, check the codes entered or maybe use the default return codes if the entry was valid and go and execute the D2 dialog, or go straight past it. @void D1::D1() { iTries = 1; ui->lineEdit->clear(); ui->lineEdit_2->clear(); ui->label_3->setText(QString("Attempt %1 of 3").arg(QString::number(iTries))); } void D1::on_pushButton_clicked() { // Check if log in was correct this time if ( (!ui->lineEdit->text().isEmpty()) && (!ui->lineEdit_2->text().isEmpty())) { if((ui->lineEdit->text()=="admin") && (ui->lineEdit_2->text()=="admin")) { accept(); // this will close the dialog with an accept return code! } } // Check if the user did it too many times iTries++; if (iTries > 3) { QMessageBox::information(this, "Log in Failed!", "Number of attempts reached"); reject(); // This will close the dialog and give a reject return code! } // setup the Gui for next login text ui->lineEdit->clear(); ui->lineEdit_2->clear(); ui->label_3->setText(QString("Attempt %1 of 3").arg(QString::number(iTries))); } // parent code: D1 * D1Dialog = new D1; if (D1Dialog->exec&#40;&#41; == QDialog::Accepted) { D2 * D2Dialog = new D2; D2->exec&#40;&#41;; } @ It is also better practice to use the class pointer <name> = new class; for dialogs etc. This has to do with stack and heap stuff in the background. Don't be afraid to use the pointers. Qt is very great in code editor to replace a used . into a -> for members and to destroy the allocated data when the dialog of his parent is destroyed. Good luck with it. (btw, I didn't test the code, so no idea if it is perfect already)
  • Q_PROPERTY NOTIFY

    11
    0 Votes
    11 Posts
    14k Views
    A
    [quote author="redlars" date="1335443671"]Is there a technical reason for this?[/quote] If you look at the code generated by the moc, you'll see that there is only two changes when you add a NOTIFY field: the property flag changes the index of the notification signal is added to the meta data array. Since the moc doesn't really know which class your class inherits from, it can't know the index of that signal in the base class. The existence of the signal would have to be tested dynamically at runtime rather than at compile time. For the READ and WRITE fields, as the function names are used as is in the generated code, if the functions don't exist, the compiler will generate an error, so the moc doesn't have to do that check itself.
  • QSystemdeviceinfo

    7
    0 Votes
    7 Posts
    3k Views
    ?
    Basically I am trying to get a window that on the press of a button will show the battery status. I will be trying this code on a beagle board. I am doing my work under the assumption that my platform is a desktop. To import qmobiity, ie do @import QtMobility.systeminfo 1.2@ do I need to add a qml file? I tried adding a qml file and I see the following error now: @In file included from ..\gui\main.cpp:2: ..\gui/mainwindow.h:32: error: ISO C++ forbids declaration of 'QSystemDeviceInfo' with no type ..\gui/mainwindow.h:32: error: expected ';' before '*' token mingw32-make.exe[1]: *** [debug/main.o] Error 1 mingw32-make.exe: *** [debug] Error 2 09:55:18: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2. Error while building project gui (target: Desktop) When executing build step 'Make'@
  • [Solve]Strange behavior program with this code

    6
    0 Votes
    6 Posts
    2k Views
    R
    [quote author="Gerolf" date="1335440000"]By the way, your code does not start the thread: @ RIconManager::RIconManager(RDataItem *parent) { item = parent; run(); } @ You call the run method inside the constructor, this is not how threads work. A thread is started by calling start();[/quote] Thank you for your note!
  • [SOLVED] QMenuBar problem

    6
    0 Votes
    6 Posts
    2k Views
    S
    You are welcome!!!!!
  • Unicode Problem..

    10
    0 Votes
    10 Posts
    6k Views
    A
    tnx every body for your help
  • 0 Votes
    1 Posts
    4k Views
    No one has replied