Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Slider Question.

    4
    0 Votes
    4 Posts
    2k Views
    L
    Ok thank you! I just wanted to know if it is label the right way! ;) Thanks
  • 0 Votes
    7 Posts
    15k Views
    S
    This "FAQ":http://developer.qt.nokia.com/faq/answer/why_is_the_warning_qobjectstarttimer_timers_cannot_be_started_from_another_ provides information on the issue as well.
  • 0 Votes
    5 Posts
    10k Views
    S
    The following "FAQ":http://developer.qt.nokia.com/faq/answer/how_can_i_get_hold_of_a_cell_widgets_row explains how you can get hold of a cell widget's row and column information. Does it provide you the information you are looking for?
  • QSqlTableModel && setDatabase

    2
    0 Votes
    2 Posts
    2k Views
    S
    Create a QSqlTableModel attach the model to your table tableView->setModel(model). Then You can use model->query("you sql command"), Or use QSqlQuery query... and model->setQuery(query). After the query I'm always doing model->query("Select * FROM table") and set the headerview again.
  • Debugging resource loss

    2
    0 Votes
    2 Posts
    2k Views
    J
    Just a FYI - turns out it was actually in a DLL that was leaking an HDC every call. I gradually narrowed this down using Process Explorer, commenting out calls as the GDI Handles went up rapidly. As I commented out calls. if I saw the GDI Handles stay stable, I went deeper and finally found it.
  • I have an error-warning when i am debugging my program!

    5
    0 Votes
    5 Posts
    6k Views
    L
    Ok thanks for you reply :)
  • Set as icons the theme's defaults?

    6
    0 Votes
    6 Posts
    8k Views
    L
    Thanks for that! I need it also for my app ;)
  • QMessageBox frameless stylesheet

    6
    0 Votes
    6 Posts
    8k Views
    E
    didn't quite helped
  • QTableView: add delete button to each row

    3
    0 Votes
    3 Posts
    8k Views
    G
    1st option sounds good enough, but how do I create such a proxy model... also, as far as option two, I'm trying to understand how to implement the QItemDelegate ::paint() so, what I have now is: @ /header portion/ class RemoveRowButoonItemDelegate : public QItemDelegate { Q_OBJECT public: RemoveRowButoonItemDelegate(QObject *parent = 0); RemoveRowButoonItemDelegate(QString & iconResourceId, QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; public slots: void removeRow(); private: QString _iconResourceId; QToolButton * btn; /*implementation portion */ RemoveRowButoonItemDelegate::RemoveRowButoonItemDelegate(QObject *parent) : QItemDelegate(parent){ _iconResourceId = ":/myApp/IDB_MINUS"; btn = new QToolButton(parent); QIcon icon; icon.addFile(_iconResourceId, QSize(), QIcon::Normal, QIcon::Off); btn->setIcon(icon); connect(btn, SIGNAL(clicked()), this, SLOT(removeRow())); } RemoveRowButoonItemDelegate::RemoveRowButoonItemDelegate(QString & _icon,QObject *parent) : QItemDelegate(parent), _iconResourceId(_icon){ btn = new QToolButton(parent); QIcon icon; icon.addFile(_iconResourceId, QSize(), QIcon::Normal, QIcon::Off); btn->setIcon(icon); connect(btn, SIGNAL(clicked()), this, SLOT(removeRow())); } QWidget *RemoveRowButoonItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & options, const QModelIndex &index) const { return btn; } void RemoveRowButoonItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { } void RemoveRowButoonItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { } void RemoveRowButoonItemDelegate::updateEditorGeometry(QWidget editor, const QStyleOptionViewItem &option, const QModelIndex &/ index */) const { editor->setGeometry(option.rect); } void RemoveRowButoonItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { if (option.state & QStyle::State_Selected) painter->fillRect(option.rect, option.palette.highlight()); //?... how do I put btn inside the cell? } @ I will add the filterEvent portion later, it will return false in all signals so, no editing will be allowed. so, how do I paint the button inside the rec of the cell? Thanks, G
  • Additional Style for Qt application

    4
    0 Votes
    4 Posts
    3k Views
    J
    I wrote something like that a few years back: http://labs.qt.nokia.com/2007/07/06/dotnet-style-with-office-flavor/ Unfortunately I am not sure where this is hosted these days as it is no longer supported. You should be able to find the source code embedded within other projects by doing some google searches for qtdotnetstyle though. This might also be interesting: http://labs.qt.nokia.com/2009/09/15/using-blur-behind-on-windows/
  • How can i get all font names in the system

    2
    0 Votes
    2 Posts
    2k Views
    frankcyblogic.deF
    Try instead: "QFontDataBase::families()":http://doc.qt.nokia.com/4.8-snapshot/qfontdatabase.html#families
  • Sorry, total Qt newbe question...

    5
    0 Votes
    5 Posts
    3k Views
    C
    Look at "Advanced qmake" :)
  • QSettings && insert comment

    17
    0 Votes
    17 Posts
    23k Views
    L
    [quote author="stuk" date="1307362137"]Yes, using # work for me on windows. [/quote] Ok, thanks. Unfortunately it doesn't works in Linux... it seems...
  • Initialize QGraphicsScene

    7
    0 Votes
    7 Posts
    4k Views
    J
    I have created canvas to insert a mouse press event.I have managed to get some results but they are not totaly right. Have a look at my previous post in the same topic
  • [SOLVED] Check if a line is selected from a QTableView

    13
    0 Votes
    13 Posts
    11k Views
    S
    [quote author="Andre" date="1307344471"]I would rather assume that the method returns something else than you think it does. While Qt is not bug free, I think such an obvious issue would have a good likelihood of biting somebody else in the ass before it did you, don't you? The current item isn't the same as the selected item, AFAIK. You interact with the selection via the selectionModel method of your view. It returns a QItemSelectionModel. [/quote] To begin with, I would like to thank @Andre for his valuable answer. :-) Following the essence of the answer, I substituted @if ( !( view->currentIndex().isValid() ) ) { // code to execute when no selection is made }@ with @if ( !( view->selectionModel()->isSelected(view->currentIndex()) ) ) { // code to execute when no selection is made }@ and it actually works as it should! Having said that, I have to point out (again) the fact that the code-in-question @if ( !( view->currentIndex().isValid() ) ) { // code to execute when no selection is made }@ worked as I assumed it should work at MS-Windows and not like that at my Mac. That is, it SEEMS that (no hard evidence for that, just a hypothesis I make after testing the same project with MS-Windows and Mac) view's current item is the selected item at Qt-SDK for MS-Windows (and if no item is selected, then the current item is invalid), whereas view's current item could be an invalid one or the first one if no selection is made at Qt-SDK for Mac. Maybe I am missing something here, or maybe it is something with my installation(s) of the Qt-SDK, who knows! Just wondering... ;-)
  • Put application in background

    6
    0 Votes
    6 Posts
    3k Views
    A
    Give me an example. For example, if you want gedit (GUI) to go in background, give @gedit& > /dev/null 2> /dev/null@ If a program goes itself to the background, it just launches another instance of itself with other arguments but without appending to it and it just exits. For example, if you run myapp and it just launches, then it could be something @if(!QCoreApplication::arguments.count()>1){//no arguments //execute the same app here but with & //system() executes system commands and is more C than C++ but anyways system("myapp --justlaunched&"); exit(2); } if(QCoreApplication::arguments.at(1)=="--justlaunched") mplamplampla@ This is certainly a way to do it, but there may be a more efficient way for it, because this way cannot be used if you don't allow multiple instances of your program.
  • Building QT Embedded Widgets on Windows 7

    10
    0 Votes
    10 Posts
    6k Views
    G
    Hi to all. I've noticed that, if I lock the instruction DEPENDPATH += $$PWD in the basicgraph.pri files, using a # instruction, it compiles well. #DEPENDPATH += $$PWD // line modified I don't know why (I'm studying it), but this instruction, ONLY IN PC ENVIRONMENT, resolves the compiling operation in an error. This is to be made also in the multislider.pri file.
  • QGraphicsView with QPixMap Background

    10
    0 Votes
    10 Posts
    18k Views
    E
    Okay, I see what you mean. I was trying to avoid dealing with saving a pixmap i have in my prog to relaod it in the stylesheet of the same prog but I guess there's no other way by using stylesheets
  • How to set qml listview model in C++

    6
    0 Votes
    6 Posts
    7k Views
    A
    I solved my problem, I was trying to set directly a pointer to the "model" property of the qml listview but it can't be done like this. The solution is to use the QDeclarativeContext : @ QDeclarativeEngine *engine = new QDeclarativeEngine(); QDeclarativeContext context = engine->rootContext(); MyListModel myModel = new MyListModel(); context->setContextProperty("myModelName", myModel); myQMLListView->setProperty("model", context->contextProperty("myModelName")); @
  • Apply QGraphicsBlurEffect to a window

    5
    0 Votes
    5 Posts
    8k Views
    E
    ouch I wasn't applying the effect to the viewport port directly to the QGraphicsView I shall test your way soon thanks