Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • How to know which row of the QTableWidget has the focus

    12
    0 Votes
    12 Posts
    10k Views
    A
    You are confusing the matter again. Are you using QTableView or QTableWidget? QTableWidget gives you accessor method to get the items representing the headers (if you set them, I'd think), while if you are using QTableView, you can use the model to find out the header contents as well. If you do just a little bit of searching in the documentation on a relevant term like "header" you will find them in no time flat. I am wondering though: what is your goal? Why do you need to store the contents of the headers in some variables? It doesn't seem to make too much sense.
  • How can i rotate a pixmap from horizontally to vertically?

    3
    0 Votes
    3 Posts
    3k Views
    K
    have you tried to use QPixmap::transform method ? From the Qt docs, we can invoke QTransform::rotate (90), and QTrasformationMode with Qt::SmoothTransformation using bilinear filtering.
  • [SOLVED] showing a window while a user is editing a QLineEdit field

    7
    0 Votes
    7 Posts
    3k Views
    Y
    [quote author="Volker" date="1320789006"]This basically works for me: @ void MainWindow::displayToolTip() { QPoint pos = mapToGlobal(ui->textEdit->pos()); QToolTip::showText(pos, QString("The text edit has %1 chars").arg(ui->textEdit->toPlainText().count())); } @ [/quote] I did this originally but the tooltip wasn't alway showing, probably due to me making the changes too fast. thanks.
  • How to understand Drag and Drop MIME types ?

    4
    0 Votes
    4 Posts
    7k Views
    G
    you will not drag'n'drop a widget I think you mean a listWidgetItem, right? There is a description on how to do drag'n'drop, that is (from my POV) good: "FAQ: How can I drag and drop in a widget":http://developer.qt.nokia.com/faq/answer/how_can_i_do_drag_and_drop_in_a_widget "FAQ: How can I drag from e.g a QListWidget and drop in an editable QTableView?":http://developer.qt.nokia.com/faq/answer/how_can_i_drag_from_e.g_a_qlistwidget_and_drop_in_an_editable_qtableview "FAQ: When dragging and dropping between 2 views, how can I perform a move without pressing Shift?":http://developer.qt.nokia.com/faq/answer/when_dragging_and_dropping_between_2_views_how_can_i_perform_a_move_without "Wiki: Drag and Drop within a GridView":http://developer.qt.nokia.com/wiki/Drag_and_Drop_within_a_GridView "Docs: Drag and drop support in models":http://doc.qt.nokia.com/4.7/model-view-programming.html#drag-and-drop-support-and-mime-type-handling "Docs: Drag and Drop Examples":http://doc.qt.nokia.com/4.7/examples-draganddrop.html These links should give you some ideas.
  • How to make the slot runs in receive thread?

    2
    0 Votes
    2 Posts
    2k Views
    G
    is TCPSocketThread a subclas of QThread? If yes, the object itself belongs to the creating thread (typically the main thread), and the slot will be executed there. "Have a look at peppes article about threads.":http://developer.qt.nokia.com/wiki/ThreadsEventsQObjects
  • How to get the correct size from QStaticText

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Cant play sound on Windows 7 [Solved]

    11
    0 Votes
    11 Posts
    6k Views
    M
    it should be fixed. not good idea on using #ifdef OS for a syntax like this!
  • 0 Votes
    8 Posts
    3k Views
    R
    [quote author="Rajveer" date="1320743912"]Hi Andre How to add image file in post please tell so that i can add image to show what i want to read from QTableView.[/quote] For example "postimage":http://postimage.org/ !http://postimage.org/image/4sumhxkgb/(stepashka)!
  • Format percentage column

    10
    0 Votes
    10 Posts
    9k Views
    A
    A lot of thanks, now I understand how it works!
  • Urgent help required !!! How to read the tableview index number?

    6
    0 Votes
    6 Posts
    4k Views
    F
    Hi, Well, your correct. Since I was posting this question behalf of my friend and I think i'm lacking the understanding of his requirement. Now, I've requested my friend to post directly his requirement. Sorry for higlighting it!!!
  • How to change taskbar icon during runtime on windows

    6
    0 Votes
    6 Posts
    9k Views
    F
    If I get it right the taskbar is showing the exe icon while you want another icon. As Broadpeak explained, the icon in the taskbar is platform dependent and depends on how the application "taskbar" on windows manages icons. I don't think there is a common and simple solution for this.
  • Set pixels of RowWrapPolicy::WrapLongRows

    3
    0 Votes
    3 Posts
    2k Views
    E
    Thank you for your answer! I have tried @formLayout->setRowWrapPolicy(QFormLayout::WrapLongRows);@ already, but then it only wraps when the whole row is filled by text. I'm sorry, but how can I set the sizeHint()? I would like the first column to be fixed and the second column should expand. Or for example set the ratio of the width of the columns (e.g. 1:2).
  • 0 Votes
    5 Posts
    2k Views
    R
    [quote author="Andre" date="1320734170"]Moved to General & Desktop (from Quick), as I think it belongs here.[/quote] Thank's Andre.
  • QListWidgetItem

    3
    0 Votes
    3 Posts
    2k Views
    M
    Oh thank you very simple. Regards
  • [SOLVED] Additional widget like in QComboBox

    8
    0 Votes
    8 Posts
    6k Views
    R
    Thanks. QComboBox::setModel() helps.
  • Reusing QtCore module in any C++ project

    9
    0 Votes
    9 Posts
    4k Views
    A
    I think signal/slot handling can be done without having an eventloop, but only if you use direct connections only. By default, signal/slot connections are direct, unless the thread the emit happens in is different from the thread in which the object lives. In that case, a Queued connection is used, which does need an eventloop. Lukas already explained that earlier in this topic. QObject is quite fundamental to using any of the nice Qt features, so I see little chance of getting around it. However, I think quite a bit can be done without using a QCoreApplication, though I think GUI stuff and sockets and the likes of those are off.
  • Setting volume in Phonon

    7
    0 Votes
    7 Posts
    5k Views
    J
    mohsen> I haven't compiled it myself. I use the program many different computers and it works the same on all of them. I don't want to control master volume, I want to control the volume internally. So this works OK for me, just the change in dB seems to be bigger then I intent. Regarding QtMultimediaKit, I plan to switch to it. But the last time I tried it, it didn't work on Windows. There was no binary available and when I tried to compile it myself, it always failed (with both MinGW and MSVC). I'll check it again but I'm afraid there won't be any change before Qt 4.8.
  • How to show distinct rows in QSqlTableModel filter?

    4
    0 Votes
    4 Posts
    7k Views
    F
    Please note that the proxy solution is fine if you don't have a lot of duplicate rows. In such case in fact, you will query all the database rows and drop them later, which can be bandwidth and time consuming. The best solution is to drop to SQL, after all if you are going to do such a filtering chances are you will need complex queries later on.
  • [Solved] Validating when a button is pressed

    3
    0 Votes
    3 Posts
    2k Views
    F
    [quote author="saho" date="1320674768"] But is it also possible to let the user enter everything and check afterwards if it is a valid input? [/quote] Connect a slot to the focus signals (which one you are interested in) and call the validator's validate method there, without having to tying the validator to the line editor.
  • Phonon::VideoPlayer

    2
    0 Votes
    2 Posts
    3k Views
    B
    For starting (from this book: "Advanced Qt Programming"): @ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { playIcon = QIcon(":/play.png"); pauseIcon = QIcon(":/pause.png"); mediaObject = new Phonon::MediaObject(this); mediaObject->setTickInterval(OneSecond); videoWidget = new Phonon::VideoWidget(this); Phonon::createPath(mediaObject, videoWidget); audioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this); Phonon::createPath(mediaObject, audioOutput); createActions(); createToolBar(); createWidgets(); createLayout(); createConnections(); setWindowTitle(QApplication::applicationName()); } ... // i.e: one method of the others: void MainWindow::playOrPause() { switch (mediaObject->state()) { case Phonon::PlayingState: mediaObject->pause(); playOrPauseAction->setIcon(playIcon); break; case Phonon::PausedState: // Fallthrough case Phonon::StoppedState: mediaObject->play(); playOrPauseAction->setIcon(pauseIcon); break; default: break; } } @ Edit: please use @ tags around code sections; Andre