Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • Textedit changing the linespacing for wordwrap text

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • GrabMouse() without a window?

    3
    0 Votes
    3 Posts
    3k Views
    R
    If you're working on a Windows host imho it's better to use the WinAPI for this: Use the GetCursorPos function for the position: http://msdn.microsoft.com/en-us/library/ms648390.aspx And GetKeyState for the Click-State: http://msdn.microsoft.com/en-us/library/ms646301(VS.85).aspx (VK_LBUTTON => List: http://msdn.microsoft.com/en-us/library/dd375731(VS.85).aspx) Taking a screenshot is done with GetWindowDC and BitBlt (Search it on msdn) Hope it helps you
  • How to do such a layout ?

    4
    0 Votes
    4 Posts
    2k Views
    R
    what do you mean with "better use a UI" ?
  • Dynamic properties

    5
    0 Votes
    5 Posts
    4k Views
    L
    [quote author="Andre" date="1320226863"]Often, it is a quick-and-dirty way to add properties to an object that could (and perhaps should?) be added to the object using subclassing instead.[/quote] There are situations where you cannot use subclasses, for example QApplication and QDeclarativeView in conjunction with the Harmattan Booster / MDeclarativeCache. In such situations dynamic properties are actually quite handy to "attach" some data to objects - which becomes even globally accessible when attached to QApplication.
  • Problems with QQuaternion

    5
    0 Votes
    5 Posts
    4k Views
    B
    Thanks to both of you. Especially to FranzK. It was exactly the problem. Now its working. One thing was wrong as well. It should be: @ OpenGLScene::anglex = 5; @ or @ OpenGLScene::anglex = -5; @ Otherwise the rotationangle gets bigger and bigger with every click. For those who are interested.
  • [SQL] MySQL error codes

    2
    0 Votes
    2 Posts
    3k Views
    B
    I think I can answer myself :) Instead of @db.lastError().number()@ should be @query.lastError().number()@ db (QSqlDatabase) refers probably to whole database and that's why it doesn't return error codes of unsuccessful executed queries. Topic can be closed.
  • QWidget with parent fully transparent

    9
    0 Votes
    9 Posts
    7k Views
    D
    I didn't try QML/Qt Quick still. Currently was another goal - study basics of this FrameWork and trying to do something cool and nice with that. Without basics the jump to QML would have been a very stupid step.
  • [SOLVED] QSettings: Remove entire group from ini file

    3
    0 Votes
    3 Posts
    9k Views
    V
    ahh I see. I was a little confused of what they were trying to do. Alls I would need to do is @ inifile->remove(groupname); @ Ill try it out, thank you! Edit: Its tested and works great, thank you for your help :)
  • Database connectivity in qt

    13
    0 Votes
    13 Posts
    6k Views
    G
    Good to know it works now. You should be aware, that the first argument to addDatabase is always the driver type (i.e. on of "QSQLITE" or "QMYSQL" for example). If you want to give your database connection a "handle name", add it as a second argument. But IMHO that's only needed in case you have to deal with multiple connections. If you only have one connection, the default scheme should be sufficient.
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • 0 Votes
    11 Posts
    7k Views
    G
    If everything is packaged fine into a namespace, you have no objects inside the global namespace and all is fine. I was just not 100% sure, whether it is that way internally in qt. Otherwise, on Linux, you could run into problems, if you have different global objects with the same name. As it works, it seams to not use global objects now outside the namespace.
  • Security issue with compiled application

    14
    0 Votes
    14 Posts
    6k Views
    G
    [quote author="mohsen" date="1319973211"]@Gerolf: I tested a simple app in vb6. i didn't find my string content. with GCC even label texts, lists and everything is fully visible![/quote] Hi, just as a side note: I created a small VB program with a label and some text in the code, opened the executable in notepad++ and found it within 10 seconds. It's not encrypted. Text in resources is stored as ASCII string and text in source code as UTF16 string, which means, notepad++ shows: H<nul>a<nul>l<nul>...
  • Not received QFtp's commandFinished signal

    4
    0 Votes
    4 Posts
    4k Views
    M
    Thanks for your attention. I try to give more info about my code. The QFtp is created in run function of a QThread. Call connectToHost and login. Call get to download a list file from the ftp server. The list file is a text file, every line represents a file's full path on the ftp server. Parse the list file and call get to download files in the list file one by one. After every QFtp command call, I will wait the command's result. The wait function is as below: @ bool DoThread::waitFtpCmd(QFtp *ftp, const int waitSeconds) { QDateTime dtStart = QDateTime::currentDateTime(); while(true&#41; { qApp->processEvents(&#41;; if (!ftp->hasPendingCommands() && ftp->currentCommand() == QFtp::None) { if (ftp->error() != QFtp::NoError) { showInfo("Error", ftp->errorString()); } else { showInfo("Ftp", "Cmd OK"); } return ftp->error() == QFtp::NoError; } if (waitSeconds > 0 && dtStart.addSecs(waitSeconds) < QDateTime::currentDateTime()) { qDebug() << "ftp state: " << ftp->state(); qDebug() << "current cmd: " << ftp->currentCommand(); qDebug() << "pending cmds: " << ftp->hasPendingCommands(); showInfo("Error", "Cmd TimeOut"); break; } msleep(100); }//while return false; } @ The problem occurs in the 4th step, after downlaod n files, while n maybe 1, 3 or any other number. All the file I want to download is the same size. Normally do
  • How to add another row to QFileSystemModel?

    2
    0 Votes
    2 Posts
    4k Views
    A
    You are probably interestested in "this":http://developer.qt.nokia.com/forums/viewthread/10715 related topic. You can use a proxy model to add content to your model, but it is not trivial to do. What you do is reimplement the rowCount and data methods (and possibly others) to return your new items at the right place in the tree.
  • Class declaration error

    5
    0 Votes
    5 Posts
    9k Views
    A
    Having an "undefined <something>" error almost always is the result of one of these errors: A typo in the type name A forgotten #include There are some other possibilities, but I won't bore you with those.
  • QFileDialog

    8
    0 Votes
    8 Posts
    6k Views
    M
    I just run into a similar problem where the user needs to choose a directory or a file from a File Dialog Here's my hack to solve it. subclass your class from QFileDialog and set the FileMode to AnyFile @ QFileSystemModel *model = new QFileSystemModel; model->setRootPath(QDir::currentPath()); QStringList filenames; QList<QUrl> urls; urls << QUrl::fromLocalFile&#40;QDesktopServices::storageLocation(QDesktopServices::DesktopLocation&#41;&#41; << QUrl::fromLocalFile&#40;QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation&#41;&#41;; mfiledialog->setSidebarUrls(urls); mfiledialog->setFileMode(QFileDialog::AnyFile); mfiledialog->setViewMode(QFileDialog::Detail); Then have a slot to change FileMode on currentchanged signal as follows void MainWindow::on_mfiledialog_currentchanged(QString filedir) { QFileInfo finfo = QFileInfo(filedir); if(finfo.isDir()) mfiledialog->setFileMode(QFileDialog::Directory); else mfiledialog->setFileMode(QFileDialog::AnyFile); } @ Edit: please put @ tags around code sections; Andre
  • QGraphicsView.translate doesn't seem to do anything

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • QInstallMsgHandler doesn't work at QtService App, is it true?

    3
    0 Votes
    3 Posts
    3k Views
    M
    At this task, i write all info to the text file, i have 2 projects at one solution, first - for debug service (there i write all info to the QTextWidget and to the file), and second - it's a service project, witch use same source code as first, but have another application at the main function and don't use widget for display info (just log file).
  • Qt Titlebar Aligning Title to left or right

    5
    0 Votes
    5 Posts
    6k Views
    R
    [quote author="Gerolf" date="1320170263"]The title bar is done by the OS. YOu can only change the behavior by doing platform specific things...[/quote] Awesome, thanks, =). Yeah, I'm running Gentoo Linux here.