Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Getting an excel file

    8
    0 Votes
    8 Posts
    7k Views
    K
    thanks alot
  • [SOLVED] convert a string to a variable and visa versa

    7
    0 Votes
    7 Posts
    3k Views
    K
    thank you.
  • Minimum size of static-linked Qt GUI app?

    8
    0 Votes
    8 Posts
    9k Views
    L
    I "think" they are release libs because I configured with release option on. And I'm talking about static lib, 2MB QtCore and 8MB QtGUI seems unbelievable to me... Anyway, what I'm caring about is the size of the final static-linked app.
  • Minimizing Application to Tray

    25
    0 Votes
    25 Posts
    39k Views
    R
    Yep, that's why I gave the second block of code (which I've just realised had the processEvents() call still in it - it wasn't meant to be there)
  • MIDI callbackhook implementation

    2
    0 Votes
    2 Posts
    2k Views
    F
    Depends on the work done in the callback. Usually the callback function is executed in the library's thread, which may be your main thread. If you need to feed back information into your application, it's probably a good idea to read "Threads, Events & QOjects":https://developer.qt.nokia.com/wiki/Threads_Events_QObjects for more information on how to pass event callbacks into the event loop.
  • Draw a Line in a Text Label

    5
    0 Votes
    5 Posts
    4k Views
    G
    You could use the "text frame feature of a QTextDocument":http://doc.qt.nokia.com/4.7/richtext-cursor.html#frames which can have a border and check, how it looks like in the RTF format.
  • [SOLVED] Problem compiling with Qt Creator

    4
    0 Votes
    4 Posts
    6k Views
    Z
    Ah okay, I see my mistake, @ //Wrong QFuture<void> future = QtConcurrent::run(concurrentFunction(&timer)); //Right QFuture<void> future = QtConcurrent::run(concurrentFunction, &timer); @ Thanks for your help!
  • Problems while using QPushButton

    10
    0 Votes
    10 Posts
    4k Views
    R
    [quote author="loladiro" date="1313320494"]"This is currently being discussed to be merged into Qt5":http://developer.qt.nokia.com/wiki/New_Signal_Slot_Syntax There's a link to the repository with the code in that article and there's also a merge request for it with qtbase. And then stuff like this will be possible: @ connect(sender, &Sender::valueChanged, [=](const QString &newValue) { receiver->updateValue("senderValue", newValue); } ); @ Or as is our example @ QObject::connect(play, SIGNAL(clicked()), ={sli->setValue(150);}); @ THIS CODE IS NOT WORKING IN QT4, AND MIGHT NOT EVEN WORK IN QT5 AS THE SYNTAX IS SUBJECT TO CHANGE[/quote] Thanks, really impressive.
  • How to change style of window?

    9
    0 Votes
    9 Posts
    15k Views
    G
    [quote author="soroush" date="1313309286"]bq. Changing this must be done in an OS dependant way by overwriting some messages… So, how should I do that?[/quote] As I told you, it's OS dependant. I don't know how to do it on Linux / mac, but on windows, you have to overwrite winEvent and handle WM_NCXXX messages. there are couple of descriptions around on the internet about that, so I suggest you search with google. It's not trivial, and it's on my list to write a wiki for windows on that, but that's currently far away, it's much code you need for that currently...
  • 0 Votes
    7 Posts
    15k Views
    U
    Thanks , working great
  • [SOLVED] help with signal and slot

    5
    0 Votes
    5 Posts
    2k Views
    K
    i got it working. i solved it with the first reply advice plus i did not have a click event. thank you for your help.
  • [Solved] How to detect QMainWindow destroy signal?

    7
    0 Votes
    7 Posts
    11k Views
    EddyE
    try @myWin *dialog = new myWin(this); dialog->setAttribute(Qt::WA_DeleteOnClose, true); dialog->show(); @ Edit : Gerolf is faster ;)
  • Qt Listview

    2
    0 Votes
    2 Posts
    2k Views
    G
    That's by design. A Listview is a plain list, not a tree. And a list has noch child elements. It's a table with only one column. If you want to exapnd collaps child elements, you need a treeview.
  • [SOLVED] help getting signal and slot to work

    10
    0 Votes
    10 Posts
    3k Views
    K
    thanks for the code alexisdm.
  • [SOLVED] calling a function outside of the dialog class

    20
    0 Votes
    20 Posts
    8k Views
    K
    also, i am starting to understand what can and can't be done inside of a constructor.
  • [solved] Multiple Lines of text in QToolbox buttons

    6
    0 Votes
    6 Posts
    12k Views
    EddyE
    Great you solved it! Could you edit your title and add [solved] in front of it? [done -mariusg]
  • [SOLVED] showing the dialog in a different way

    9
    0 Votes
    9 Posts
    3k Views
    M
    According to this code, you're not declaring it in the .cpp file either. To declare the variable, you need to add (to your mainwindow.h file) @ protected: loginBox * login; @
  • [Solved] How to iterate all widgets in a QWidget window?

    4
    0 Votes
    4 Posts
    25k Views
    L
    Not at all, that was an example. I didn't know how many of those you had so I settled with the easier variant to write down, thinking you would adapt it appropriately (and you did ;) ).
  • Main application window and a dialog interaction

    7
    0 Votes
    7 Posts
    5k Views
    A
    Hmm... why Window Flags Qt example does not have that problem in that case? However not in Mac, need to check other OSs.
  • TableView model proxy problem

    2
    0 Votes
    2 Posts
    3k Views
    P
    Here is the code for the tableView that is in reverse order and not highlighted correctly: dlgprint.cpp @void DlgPrint::createReportTable(QStringList stringList) //strinLlist is used elsewhere { printModel= new QSqlRelationalTableModel (this); printModel-> setEditStrategy(QSqlTableModel::OnManualSubmit); printModel-> setTable (mTableName); //string identified through assessor function printModel-> setRelation (2, QSqlRelation("student", "id", "LName")); printModel-> setRelation (3, QSqlRelation("testNum", "id", "Test")); printModel->setFilter(mFilterString); printModel->select(); proxy = new MyProxyModel(this); proxy->setSourceModel(printModel); ui->printView->setModel(proxy); connect(this,SIGNAL(sendRows(int, int, int, int)), proxy, SLOT(getRows(int, int, int, int))); ui->printView->setItemDelegate(new QSqlRelationalDelegate(this)); ui->printView->setSelectionMode(QAbstractItemView::SingleSelection); ui->printView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->printView->setColumnHidden(0,true);//id ui->printView->resizeColumnsToContents(); printModel->setHeaderData (2, Qt::Horizontal, "Score"); ui->printView->setSortingEnabled(true); ui->printView->resizeColumnsToContents () ; ui->printView->horizontalHeader()->setStretchLastSection(true); highlightCells(); printModel->select(); } void DlgPrint::highlightCells() { float highScore= FLT_MIN; float lowScore= FLT_MAX; float fastReactionTime=FLT_MAX; float slowReactionTime=FLT_MIN; int rowHigh=0; int rowLow=0; int rowFastReact=0; int rowSlowReact=0; float totalTime =0; float totalReactTime=0; float averageScore =0; float averageReact=0; int totalRows = 0; float currentScore; float currentReactTime; QString string; int numRows =proxy->rowCount(); for (int r=0; r<numRows; r++ ) { currentscore = proxy->index(r,2).data(Qt::DisplayRole).toFloat(); currentReactTime = proxy->index(r,3).data(Qt::DisplayRole).toFloat(); //something here to mapToSource?? if (currentScore > highScore) { highScore = currentScore; rowHigh = r; } if (currentScore < lowScore) { lowScore = currentScore; rowLow = r; } totalRows++; totalScore += currentScore; if (currentReactTime < fastReactionTime) { fastReactionTime = currentReactTime; rowFastReact = r; } if (currentReactTime > slowReactionTime) { slowReactionTime = currentReactTime; rowSlowReact = r; } totalReactTime += currentReactTime; } } if (totalRows !=0) { averageScore=totalScore/totalRows; averageReact=totalReactTime/totalRows; } emit sendRows (rowSlow, rowFast,rowSlowReact, rowFastReact); }@ I tried to eliminate the code that was irrelevant to the table creation. Hopefully I didn't forget something. What is wrong here?