Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.5k Posts
  • Reading the file content

    5
    0 Votes
    5 Posts
    3k Views
    G
    Even if you don't read it into one qstring, a file of size 1GB totally copied into RAM is really huge. Could it be read and worked in chunks? That would make the whole stuff much faster....
  • Using QProcess with mdb-tools

    3
    0 Votes
    3 Posts
    3k Views
    V
    Unfortunately, I had tried that previously using the arguments and and the command. So it seems it doesn't like something within the process initialization or something of that sort because I used your exact code and I get the same error. I just find it weird that I can use the same exact command on the command line and get an output, yet when I try to use it through a QProcess, it flags an error. Back to the drawing board! p.s. the comma is supposed to be there, -d is the delimiter flag, and the "," is the separator. My goal was to get the table names in a list and create the csv files accordingly using the split function. :P
  • Using .INI file[SOLVED]

    33
    0 Votes
    33 Posts
    17k Views
    O
    [quote author="mlong" date="1314218770"]I would suspect, then, that your original problem wasn't in reading the values from the ini format, but rather where you were setting the values to the boards themselves. I don't think you had shared that code. [/quote] Thnks for all your help so far. You are right, my problem was setting the values to the boards. sorry. I had shared all the code i had for the problem. What I did was I modified this code: @ QSettings settings("/home/test/Documents/Wave/signalgenerator.ini", QSettings::IniFormat); qDebug() << settings.allKeys();//qdebug settings.beginGroup("values"); const QStringList childKeys = settings.childKeys(); QHash<QString, QString> values; foreach (const QString &childKey, childKeys) { qDebug() << childKey << "->" << settings.value(childKey).toString();//qdebug values.insert(childKey, settings.value(childKey).toString()); if (childKey.toInt() == 1) { calfactor = settings.value(childKey).toFloat(); ui->comboBox->setItemData(0, calfactor); qDebug()<<"index:" << ui->comboBox->itemText(1)<<" value:"<<ui->comboBox->itemData(1);//qdebug } if (childKey.toInt() == 2) { calfactor = settings.value(childKey).toFloat(); ui->comboBox->setItemData(1, calfactor); qDebug()<<"index:" << ui->comboBox->itemText(1)<<" value:"<<ui->comboBox->itemData(1);//qdebug } } settings.endGroup(); qDebug() << "values hash:" << values;//qdebug@ to get this one(which worked(but only if I put it under each onpushButton function) : @QSettings settings("/home/test/Documents/Wave/signalgenerator.ini", QSettings::IniFormat); settings.beginGroup("values"); const QStringList childKeys = settings.childKeys(); QHash<QString, QString> values; foreach (const QString &childKey, childKeys) { values.insert(childKey, settings.value(childKey).toString()); if (childKey.toInt() == ui->comboBox->currentIndex()+1) {calfactor = settings.value(childKey).toFloat();} } settings.endGroup();@
  • 0 Votes
    2 Posts
    13k Views
    M
    Now its working.. after making this change.. @ void TestDlg::editItem() { QListWidgetItem *item = ui->groupsListWidget->currentItem(); item->setFlags(item->flags() | Qt::ItemIsEditable); ui->groupsListWidget->editItem(item); } @
  • [SOLVED] Help me with creating a Groupbox with listwidget and buttons!

    3
    0 Votes
    3 Posts
    4k Views
    L
    Hello andre! Thanks for the tip! It worked :) @mainLayout2 = new QHBoxLayout; mainLayout2->addWidget(ui->listWidget); mainLayout3 = new QVBoxLayout; mainLayout3->addWidget(ui->addButton); mainLayout3->addWidget(ui->editButton); mainLayout3->addWidget(ui->removeButton); mainLayout3->addWidget(ui->clearButton); mainLayout3->addWidget(ui->moveupButton); mainLayout3->addWidget(ui->movedownButton); optionsGroupBox = new QGroupBox(tr("Items")); optionsGroupBoxLayout = new QGridLayout; optionsGroupBoxLayout->addLayout(mainLayout2, 1,0); optionsGroupBoxLayout->addLayout(mainLayout3, 1,1); optionsGroupBox->setLayout(optionsGroupBoxLayout);@
  • On understanding QList copy-on-write

    8
    0 Votes
    8 Posts
    8k Views
    G
    There is no such concept of "to avoid cow(deep copy) as much as I can"! It's the other way round! Use it as much as you can, to save CPU cycles! It is up to you to decide what you want to do semantically: If you want to modify the original object, use a non-const reference. If you are about to modify the second usage of the object, but the original one you should pass it by value. You will have a shallow copy in the first place and only if you do modify the copy, the actual data is copied in memory (copy-on-write!) If you never want to modify the copy, use a const reference. This does not copy the object and makes the object read-only in the called method So, decide what you need and choose the appropriate tool for it. Don't do it the other way round, and choose the tool and look if it fits your needs. I have the impression that you're doing the latter right at the moment.
  • Regarding creating XML file

    29
    0 Votes
    29 Posts
    17k Views
    L
    [quote author="Rajveer" date="1314258209"] Now what i want is we can read this file and set the attribute values & than copy this to other file.[/quote] Take a look at the "QXmlStreamReader":http://doc.qt.nokia.com/latest/qxmlstreamreader.html documentation and "QXmlStream Bookmarks Example":http://doc.qt.nokia.com/latest/xml-streambookmarks.html.
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • [Solved] QTcpServer and event loop

    3
    0 Votes
    3 Posts
    4k Views
    A
    [quote author="Volker" date="1314223084"]For every client connection you usually have a separate socket on the server side. It seems that you mixup something when your clients get the wrong answers. If you send two messages from the same client, then your protocol seems inappropriate. You should either block in the client until a pending request has been answered or add some sort of sequence or uid to identifiy the related data.[/quote] To block the client would be inappropriate because the two - or more (depends on what the user does) - sockets are sent "in background" in way to load data, prepare fields, things like that. But to make a sequence should be correct for what I want to do. With some rewrites, it should finally works as expected. [quote author="Volker" date="1314223084"]If you have really long running operations, putting those into a separate thread could be an option. Be sure to read peppes excellent wiki article on "Threads, Events and QObjects":http://developer.qt.nokia.com/wiki/Threads_Events_QObjects to avoid common mistakes. And be aware that this will not solve your problem of wrongly ordered responses![/quote] This article sounds very nice; I'll read it tomorrow :) I think the topic can be marked as solved, thank you very much for your help! Amnell.
  • QGraphicsView with OpenGL backend

    14
    1 Votes
    14 Posts
    9k Views
    V
    if you have a not that complex scene (like few rectangle areas) raster might be an option. Otherwise (non-rectangular areas, rotated rectangles, and other stuff), OpenGL can be faster. I hope they can solve this bug fast and with a good rendering solution. But I honestly don't believe that it will be much faster ( maybe even not faster) than your workaround. That because if they change only parts of the screen, the bootleneck will still be in the driver sending stuff and possible context changes (considering that the user has a somewhat good GPU). Let's wait and see! Regards, VitorAMJ
  • [Solved]Saving and restoring an in-memory SQLite database

    9
    0 Votes
    9 Posts
    42k Views
    M
    Thanks for all the input. Very informative. I think I'm going to just have the user choose a file location on "new" instead of on "save". It's an extremely minor inconvenience for a significant performance boost. I also like the idea of using savepoints and then committing changes on save or rolling back if they choose to discard changes, since commits are fast. Again, thanks for the help.
  • [Solved] How to tell if QListWidget is empty

    4
    0 Votes
    4 Posts
    6k Views
    K
    You could check "count() == 0":http://doc.qt.nokia.com/4.7/qlistwidget.html#count-prop
  • [Solved]Problem Downloading a file

    21
    0 Votes
    21 Posts
    9k Views
    M
    Please be sure and add [Solved] to the beginning of the thread title. Thanks!
  • Password transformation for crypto app

    11
    0 Votes
    11 Posts
    6k Views
    A
    Personally, I don't see the point in allowing passwords with little entropy at all. No matter how much you salt, hash, resalt and rehash these passwords, they are still insecure. I am not the first one to remark this, but I can not stress it enough. See LinusA' s answer. I would simply stimulate the user to select a password that provides sufficient strength. !http://imgs.xkcd.com/comics/password_strength.png(xkcd on password strength)! (Image from xkcd.com)
  • [Moved] what does qt event code = 44 mean&#63;

    4
    0 Votes
    4 Posts
    2k Views
    G
    The discussion about subclassing QApplication has been split off to a "separate thread":http://developer.qt.nokia.com/forums/viewthread/9104/ and this thread is moved to the General forum.
  • [SOLVED] Execute java with Qt QProcess in Windows OS

    11
    0 Votes
    11 Posts
    8k Views
    G
    Because it is treated as one single argument. Actually you need two arguments (the -jar and the list of jars).
  • [Split] QApplication subclassing problem

    6
    0 Votes
    6 Posts
    4k Views
    G
    [quote author="Tratstil" date="1314177630"] I put init() in qtgame constructor in my first version.[/quote] Then it is crystal clear why it does not work: You call setOrganizationName() and the others after the constructor of qtgame has finished. So, your init() method is called in the constructor just before the names have been set. BTW: You should consider to not "abuse" QApplication for your purposes. For me it looks a bit odd, and I would create a specialized object for the phonon stuff.
  • Qt MAC Application exits automatically after compiling

    Locked
    6
    0 Votes
    6 Posts
    3k Views
    G
    Closed thread, please follow up in "this thread":http://developer.qt.nokia.com/forums/viewthread/9097/ for the NSCFArray/QCocoaView error.
  • Crash in QVariantMap/QVariantList destructor

    8
    0 Votes
    8 Posts
    5k Views
    G
    Mixing wrong DLLs can lead to that effect. The "Dependency Walker":http://www.dependencywalker.com/ shows you the loaded (or missing) DLLs. Be aware, that it shows different results than using it from within the IDE, as the latter may have manipulated the search PATH.
  • [SOLVED] problem with textEdit layout

    7
    0 Votes
    7 Posts
    3k Views
    K
    thank you Eus. thank you everybody. i never knew that i could resize the buttons after the layout was made. this topic is solved.