Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • Replace ncurses-Masks of Fortran-Progr. with Qt-Masks

    2
    0 Votes
    2 Posts
    2k Views
    C
    If I understand you correctly, you have a Fortran program that uses nurses to get user input, and you basically want to convert it to use Qt, but without requiring major modifications to the original code, basically just trying to use Qt as a drop-in replacement. The problem is, Qt (and really all modern GUI packages) operate on a fundamentally different paradigm from ncurses, as you just discovered when you entered the event loop. nurses doesn't have en event loop, you manually step through each screen and your code basically draws them in sequence. Qt is an event-driven architecture: this allows it to respond to mouse clicks, lets you drag windows around, have multiple dialogs up at once, etc.: it's the foundation of modern user interface design. As such, converting from nurses to Qt is not at all straightforward. That is not to say it cannot be done, of course, but you need to reverse the problem: think of the Qt program as your main program, and your Fortran code as running inside of it. You want your various function calls from Fortran to act as events in Qt's event loop, and then write handlers that show the appropriate dialogs and then return the data to the Fortran code. All told, this is a big undertaking: is there a version of this Fortran code that simply reads an input deck (i.e. that doesn't use the nurses stuff)? The way I usually write this sort of interface is to design a GUI that ultimately just writes the input deck out and then triggers the Fortran code to read it.
  • Memory leak with valgrind

    3
    0 Votes
    3 Posts
    3k Views
    G
    Yes (provably not all, but a lot of them), and I try some solutions proposed and they couldn't solve my problem
  • Handling Main Window and Sub Windows

    6
    0 Votes
    6 Posts
    4k Views
    W
    Thanks to all. My problem has solved. I was using @exit(0);@ in exit function of sub windows instead of @close();@
  • Simple audio over ip application

    4
    0 Votes
    4 Posts
    5k Views
    A
    And one more thing: when i place breakpoints in writeData method and readData method of Audio buffer class. I reach breakpoint in writeData evry time when put the data to buffer, but never reach breakpoint in readData method. Is it means that my Audio output doesn't read any data from buffer ?
  • QLineEdit doesn’t accept CJK symbols or punctuation on Mac OS X

    7
    0 Votes
    7 Posts
    3k Views
    F
    See the detail in following picture !http://paste.ubuntu.org.cn/i109210(demo)! http://paste.ubuntu.org.cn/i109210 In the terminal, the former is English punctuation \u002C, the later is CJK punctuation \uFF0C. I can type both former and later via "Edit -> Special Characters" in non-Qt application(such as Apple Terminal) on Mac OS X, however, I can't type the later one \uFF0C in Qt application.
  • Please solve this Q_INIT_RESOURCE error

    5
    0 Votes
    5 Posts
    10k Views
    M
    I added that .qrc file now it works fine... but i thought its just an image file. thank u Qtnovice...:-)
  • Help using QFile::open with a variable file path

    4
    0 Votes
    4 Posts
    10k Views
    C
    Oh, I see: the open() method of Qfile doesn't work the way you are thinking. You either need to pass the filename to the constructor, e.g. @Qfile file (filename)@ or you need to set the name and then call open(), e.g. @Qfile file; file.setFileName (filename); file.open(QIODevice::ReadWrite);@
  • Questions on producing pdf files.

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Scrolling over a series of buttons

    4
    0 Votes
    4 Posts
    3k Views
    C
    Yeah, I'm being dumb, that wouldn't work. I think you really just want to use a QTableView, which will let you set a scroll policy that scrolls in entire-widget increments.
  • Can we convert a string of type Qstring to char*?

    Locked
    5
    0 Votes
    5 Posts
    4k Views
    G
    Thread closed, this is a FAQ.
  • In window XP, I failed to open a database file comes from Android phone.

    20
    0 Votes
    20 Posts
    11k Views
    G
    Just for the records, if anyone stumbles over this old thread: In the recent release 4.8 of Qt the included SQLite has been updated to version 3.7.7.1.
  • [SOLVED]4.8 VS2010 Cannot load pdb file

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • How to Decrease the Size of Qt Apps/libraries?

    11
    0 Votes
    11 Posts
    7k Views
    G
    [quote author="wasim3s" date="1323970581"]You mean i should study how to share Qt libraries in a system...?[/quote] you can install them in the system or beside your executable EDIT: by the way, I checked my VCL installation, it's 56 MB :-)
  • Multiple Font Sizes with on the fly sizing

    2
    0 Votes
    2 Posts
    2k Views
    Q
    In MainWindow you could use the following line: @ this->setStyleSheet(QString::fromUtf8("font: 10pt FreeMono;"));@ to set FreeMono 12pt font globally... You can also limit the stylesheet to some widgets by properly defining the stylesheet, e.g: @ this->setStyleSheet(QString::fromUtf8("QLabel {font: 10pt;}"));@ just to set font size only for QLabels... I hope it helps.
  • [SOLVED] QMdiArea::addSubWindow() issue

    4
    0 Votes
    4 Posts
    8k Views
    S
    The problem was show(). I tested the old code with show() and now it works: @QMdiSubWindow *subwin1 = ui->mdiArea->addSubWindow(new QPushButton); subwin1->setAttribute(Qt::WA_DeleteOnClose); subwin1->show();@ Thanks again joeuser.
  • QGraphicsScene itemAt - allow radius around point?

    6
    0 Votes
    6 Posts
    3k Views
    S
    I just tried using the shape function. It worked exactly as desired for boundary hit detection but it seriously messed up the repainting of my other polygons in the scene during mouse events! Putting a breakpoint in the function showed that it was being called all the time and I had to remove the breakpoint. Looks like the items function is working better, I just have to decide what values I'd like to use and do similar things in my scene's hover event to change the cursor when its near the boundary.
  • 0 Votes
    6 Posts
    6k Views
    Q
    Hi p-himik,[quote author="p-himik" date="1323954376"]You can hide actual data behind a pointer which you can protect with QAtomicPointer, can't you?[/quote]I understand that QAtomicPointer class provides atomic operations on pointers. I can obviously use a pointer but the worker thread should keep a copy of the generic variable to be updated: a change in a variable right value doesn't mean a change in its pointer. Hi Gerolf,[quote author="Gerolf" date="1323954775"]I would use one global mutex if the access is fast. If access takes more time for some of the globals, perhaps having one for the heavier ones and one for the quick ones could also be a good idea.[/quote]I fully understand your suggestion. Frankly I found basic threads documentation a little too complex and I hoped my solution could still be appropriate. Thank you for your confirmation!
  • Problem in reading a '\n' character from a file?

    17
    0 Votes
    17 Posts
    10k Views
    P
    [quote author="Seba84" date="1323954519"]Sorry Fluca, I mistaken the name, I was talking to practik041. The post I did was practically at the same time as yours, I saw yours after posting it. Practik, You do not want to understand. Can you check the manual? You can handle %s with the QString::arg() function, definition: @QString QString::arg(const QString & a, int fieldWidth = 0, const QChar & fillChar = QLatin1Char( ' ' ) ) @ Here it is an example from the QT Help: @QString i; // current file's number QString total; // number of files to process QString fileName; // current file's name QString status = QString("Processing file %1 of %2: %3").arg(i).arg(total).arg(fileName);@ See the manual for more info.[/quote] I have seen the manual. It is clear to me.
  • QStandardItem containing multiple children not shown

    7
    0 Votes
    7 Posts
    4k Views
    K
    is it maybe possible to have for example a QListView for each cell of a QTableView ?
  • Is there any way to connect the Python scripts to the Button click event?

    16
    0 Votes
    16 Posts
    15k Views
    M
    Ive had this same problem and this was just answered for me on the #Qt You will need to execute the cmd.exe with /c which will start the python script with the proper associated interpreter. @ QString command("cmd.exe"); QStringList args; args << "/c" << "c:/Test.py"; @ One other thing to remember is that not all extensions are executable and you must add them to the PATHEXT list. @ echo %PATHEXT% set PATHEXT=%PATHEXT%;.PY @ I also read about QProcess::setNativeArguments added in qt 4.7 which is for windows arguments.