Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • Should we have our own focus policy

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Need some help with QIODevice based buffer class

    5
    0 Votes
    5 Posts
    4k Views
    A
    I found the place when it clicks. It clicks when I reach the end of buffer and make switchBuffer, so thats why when I make my buffer bigger it clicks rare, but why and how to solve it ?
  • How to hyperlink a data item in a QTableview table.

    8
    0 Votes
    8 Posts
    11k Views
    K
    to detect the mouse click and react to it depending on the pressed mouse button just reimplement the mousePressedEvent(QMouseEvent* event) for your QTableView. @ void YourTableView::mousePressEvent(QMouseEvent* event) { // get the buttons type Qt::MouseButtons mouseButton = event->buttons(); // only the right mouse buton if( mouseButton == Qt::RightButton ) { // clear the previous selection clearSelection(); // select the item at the position of the right-click event QPersistentModelIndex nextIndex = indexAt(event->pos()); setCurrentIndex(nextIndex); // this is where I start my custom context menu, do the stuff you want to here } else { //call the parents function QTreeView::mousePressEvent(event); } } @ When you have retrieved the index for the event position you should also have a check if the cell related to the index of the event position is your hyperlink or not.
  • Tray icon is not launching the activated() signal

    4
    0 Votes
    4 Posts
    3k Views
    G
    That would be a feature of the Qt libs, not Creator :-) Unfortunately, I don't know about that. But with Ubuntu/Unity being based on Qt, I would say the chances are not too bad...
  • How to grab raw video frames without displaying them

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Adding button to Two QButtonGroup

    4
    0 Votes
    4 Posts
    2k Views
    K
    instead of being so cryptic All I am trying to do is I have two buttons and I am trying to attach a tab order from one button to the stacked widget and from that to another button,. and in my case stacked widget can contain set of button,.. settaborder(leftbutton, stackedwidget) settaborder(stackedwidget, rightbutton) is not working for me,.. I tried to setfocuspolicy before doing this to tabfocus,but still of no use
  • How to make painter->drawText selectable and NOT editable

    4
    0 Votes
    4 Posts
    2k Views
    J
    Once you learn ow to use QAbstractItemDelegate class you will know about Its' memeber createEditor(),setEditorData(), and setModelData(). And then you will know how to create your own readonly QLineEdit Editor when select a item in your QAbstratItemView .
  • Removing row from QTableWidget, showing no effect

    6
    0 Votes
    6 Posts
    4k Views
    A
    Oh....Thanks a lot Andre.... Ya i tried backword loop....it works fine now....:) Thank u so much..!!!
  • 0 Votes
    2 Posts
    1k Views
    G
    The code looks ok at a first sight. Did you try to run a debugger? Put some qDebug() message into the methods. Did you forget to set the delegate on the view?
  • Trying to render TextLine in itemdelegate , but can't see it

    8
    0 Votes
    8 Posts
    3k Views
    S
    If i right understood ideology of m/v and item u can not correctly set: item1 |widget1 | widget2| widget3| item2 |widget1 | widget2| widget3| with painting method. But you can try: @class MyWidget : public QWidget { Q_OBJECT private: QLabel *pictureLabel; QLabel *textLabel; QHBoxLayout *layout; public: MyWidget(QWidget *parent = 0) : QWidget(parent) { pictureLabel = new QLabel(this); textLabel = new QLabel(this); layout = new QHBoxLayout(this); layout->addWidget(pictureLabel); layout->addWidget(textLabel); layout->setContentsMargins(0, 0, 0, 0); // margin: top right bottom left setLayout(layout); } void setText(const QString& text) { textLabel->setText(text); textLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); } QString text() const { return textLabel->text(); } void setPicture(const QString& path) { pictureLabel->setPixmap(QPixmap(path)); } };@ and than use code above but: @ view.setIndexWidget(item1.index(), new MyWidget); @
  • When does QGraphicsWidget::size() become valid?

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • 100 % of Processor when playing audio.

    10
    0 Votes
    10 Posts
    5k Views
    A
    One more thing: When I minimize some windows in system playback stops for the moment and after minimizing - continues again. So is there a thread problem or any else ?
  • Question about model/view design

    4
    0 Votes
    4 Posts
    2k Views
    A
    Sorry, I know nothing about java and its possible problems with model-view. Note that a QSortFilterProxyModel does not replace a QAbstractItemModel, but is used on top of it.
  • [Beginner]Calculate two values from lineEdit

    6
    0 Votes
    6 Posts
    6k Views
    Y
    "This is the right link.":http://www.qtrac.eu/C++-GUI-Programming-with-Qt-4-1st-ed.zip
  • QTimers spawn new threads every time?

    3
    0 Votes
    3 Posts
    2k Views
    M
    I'm pretty sure that is what is doing. My debugger window will constantly spam those thread exited/thread created messages as long as I have my timers on. If I turn them off, no messages.
  • Fixed size array as Qt Property?

    10
    0 Votes
    10 Posts
    9k Views
    G
    Sometimes, for whatever reason, some of the autogenerated files (moc, for example) are not update on a new build. By cleaning the project and rebuilding completely one make sure that those are generated from scratch and resemble the current state of your actual source files.
  • Loading swfs in QAxWidget only full paths load

    4
    0 Votes
    4 Posts
    4k Views
    G
    In this case I would suspect that the current environment (especially current directory) is not passed to the native control - for whatever reason.
  • QString to double-value

    6
    1 Votes
    6 Posts
    43k Views
    S
    [quote author="Lukas Geyer" date="1326285390"]Or, if you want to stick to your approach, use a better expression. @ QString::remove(QRegExp(" .*")).toDouble(); @ [/quote] This is pretty much what I needed, thank you very much. Wonder why I didn't came up with it by myself :D [quote author="Andre" date="1326287063"]And please, check the result of toDouble by using the bool* ok flag, and do something sensible if it fails. You cannot assume a QString to bool conversion always succeeds. [/quote] I do, but so far never came to a point where the conversion (in my application) actually failed. Lucky me! [quote author="dvez43" date="1326288531"]you could always use QString(string).split(" ") if you know that there is always going to be a space inbetween the unit specification and the number. So when you set that equal to a stringlist, your first array element will be what your looking for. Then manipulate from there. @ QString temperature = "-30.8 °C" QString conductivity = "4.30e^-5 mS/cm" QStringList tempSL = temperature.split(" "); QStringList tempCN = conductivity.split(" "); double value1 = QString(tempSL[0]).toDouble(); double value2 = QString(tempCN[0]).toDouble(); @ Im not sure of your application but this is how I would do it if I were possibly going to need the units in the future (which are located in the 2nd element of the stringlists). Heres the docs incase you find a better way to use it: http://developer.qt.nokia.com/doc/qt-4.8/qstring.html#split :) [/quote] In fact this would work to. Can't tell which works better for my case. Since Qwt-plot won't need the units so far I stick to sth like this: @ bool ok; double valueForQwt = QStringWithUnit.remove(QRegExp(" .*")).toDouble(&ok); if(!ok) //Error @ Thanks to all of you!
  • Splitter position in designer

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • How to add images and text watermark

    10
    0 Votes
    10 Posts
    5k Views
    M
    You may get help from watermark software, which can easily settle the issue. With the help of it, you can add batch text watermark and image watermark to photos.