Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • Qt binaries

    15
    0 Votes
    15 Posts
    7k Views
    G
    YOu should look in the folder you use, not in QtCreatiors folder: <Qt SDK dir>\Desktop\Qt\4.7.2\msvc2008\bin
  • All Application Resizing

    12
    0 Votes
    12 Posts
    5k Views
    A
    Ok, I see the tutorials and use the layout. Thanks all for the infos!
  • [SOLVED] How can I test whether a .pri file has already been included

    6
    0 Votes
    6 Posts
    7k Views
    D
    You are welcome. Please mark thread as [solved].
  • Boost vs Qt

    13
    1 Votes
    13 Posts
    26k Views
    G
    That's why I said, both are good. You can combine them. Some parts exist in both, there I typically use Qt, but many things are only in one of Qt and Boost.
  • How to check QStringList is Empty?

    3
    0 Votes
    3 Posts
    11k Views
    J
    @Indrajeet: If you are not already using it, I highly recommend you to start using the Qt Assistant, or if you're using QtCreator, go to the help button on the bottom of the left bar. There you can get information about the whole API. And if you just go to the QStringList page, it should take you a few seconds to find the isEmpty() function. In this case, maybe you did look at the documentation of QStringList, but didn't see the function because the base class (QList) has the isEmpty() function since a QStringList is just a QList<QString> (this is shown right at the top of each class' page). You can get help here. But, you have to make an effort to solve relatively simple problems yourself.
  • Testing network programming codes

    3
    0 Votes
    3 Posts
    2k Views
    T
    You can always set up a couple of virtual machines for testing.
  • [Solved] Display QTableView in QTabWidget or QWidget

    6
    0 Votes
    6 Posts
    6k Views
    L
    From the "documentation":http://doc.qt.nokia.com/4.7/qtabwidget.html: [quote] The normal way to use QTabWidget is to do the following: Create a QTabWidget. Create a QWidget for each of the pages in the tab dialog, but do not specify parent widgets for them. Insert child widgets into the page widget, using layouts to position them as normal. Call addTab() or insertTab() to put the page widgets into the tab widget, giving each tab a suitable label with an optional keyboard shortcut. [/quote]
  • Multiple Qt versions installation issue

    7
    0 Votes
    7 Posts
    9k Views
    G
    I never used the package manager to switch to a non-default Qt version And I do not recommend this, it may break some other applications depending on that version of Qt. I also never used the SDK for pulling new Qt version. Actually, I'm not using the SDK at all - I just startet Qt development long before that saw the light and I'm too lazy to switch settings and all that. Usually, the default paths are quite sane. I generally tend to use those (not only for Qt).
  • [Solved] QML files and JPG image in QRC

    4
    0 Votes
    4 Posts
    12k Views
    D
    You are welcome. Don't forget to mark thread as [solved].
  • [solved]Support multi platform issue - Windows and Ubuntu

    4
    0 Votes
    4 Posts
    2k Views
    K
    Yes. That is what I want. I use the boost library. Inside windows, I can setup the build enviroment by add boost libray to the INCLUDE path (INCLUDEPATH in pro file not work). But in Ubuntu, I have to use the INCLUDEPATH.
  • QSS + style code

    5
    0 Votes
    5 Posts
    5k Views
    S
    When not using stylesheets, you can reimplement "event()":http://doc.qt.nokia.com/latest/qwidget.html#event for the widget and listen for "QEvent::HoverEnter ":http://doc.qt.nokia.com/latest/qevent.html#Type-enum and QEvent::HoverLeave events. When you get a QEvent::HoverEnter you can set a bool variable to true and when you get a QHoverLeave you can set the bool variable to false and make sure to call "update()":http://doc.qt.nokia.com/atest/qwidget.html#update or "repaint":http://doc.qt.nokia.com/latest/qwidget.html#repaint after having changed the value of the variable Then you can reimplement "paintEvent()":http://doc.qt.nokia.com/latest/qwidget.html#paintEvent for the widget to draw a border if the bool variable is set to true. Does this approach work for you?
  • QCheckBox in QComboBox

    3
    0 Votes
    3 Posts
    7k Views
    G
    Youre right. And furthermore, Ive done this. For my task I had to put only one check box and it was supposed to be last item in the combo box. So, now code for ItemDelegate looks like that: @class CheckBoxListDelegate : public QItemDelegate { public: CheckBoxListDelegate(QObject *parent) : QItemDelegate(parent) { } void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { //Get item data int row_count = index.model()->rowCount(index.parent()); if(index.row() == --row_count) { bool value = index.data(Qt::UserRole).toBool(); QString text = index.data(Qt::DisplayRole).toString(); // fill style options with item data const QStyle *style = QApplication::style(); QStyleOptionButton opt; opt.state |= value ? QStyle::State_On : QStyle::State_Off; opt.state |= QStyle::State_Enabled; opt.text = text; opt.rect = option.rect; // draw item data as CheckBox style->drawControl(QStyle::CE_CheckBox,&opt,painter); return; } return QItemDelegate::paint(painter,option,index); } QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem & option , const QModelIndex & index ) const { int row_count = index.model()->rowCount(index.parent()); // create check box as our editor if(index.row() == --row_count) { QCheckBox *editor = new QCheckBox(parent); return editor; } return 0; } void setEditorData(QWidget *editor, const QModelIndex &index) const { //set editor data QCheckBox *myEditor = static_cast<QCheckBox*>(editor); myEditor->setText(index.data(Qt::DisplayRole).toString()); myEditor->setChecked(index.data(Qt::UserRole).toBool()); } void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { //get the value from the editor (CheckBox) QCheckBox *myEditor = static_cast<QCheckBox*>(editor); bool value = myEditor->isChecked(); //set model data QMap<int,QVariant> data; data.insert(Qt::DisplayRole,myEditor->text()); data.insert(Qt::UserRole,value); model->setItemData(index,data); } }; @
  • [SOLVED] how to generate dynamic array of buttons????

    9
    0 Votes
    9 Posts
    10k Views
    T
    thank you all, all of you were great help. Now my problem is solved.
  • [Moved] qt thread

    2
    0 Votes
    2 Posts
    1k Views
    EddyE
    It's advided not to use the run() approach you are referring to from the Qt docs. It's better to subclass a QObject instead. Have a look at this wiki page : http://developer.qt.nokia.com/wiki/Threads_Events_QObjects Or use the tag on the right this wil give you an overview of all topics on threads on defnet.
  • 0 Votes
    1 Posts
    2k Views
    No one has replied
  • Viewable but non-editable tables

    2
    0 Votes
    2 Posts
    2k Views
    A
    You can use Qt::ItemIsEditable, Qt::ItemIsEnabled flag for QTableWidgetItem
  • Save a file in the same directory as QSettings

    11
    0 Votes
    11 Posts
    8k Views
    G
    [quote author="neFAST" date="1308696036"]I can understand this. However I don't know what I should request. I just said [quote author="neFAST" date="1307718701"]On win7, qsettings are stored in appData/Roaming while QDesktopServices::DataLocation points to appData/Local[/quote] but is it a bug? What should be the correct behavior?[/quote] I do not have an idea. I would have to read on that topic first. Maybe some googling gives you more information. Sorry that I cannot give you a more useful answer.
  • How to get only the last system event from a specific type ?

    5
    0 Votes
    5 Posts
    2k Views
    D
    I think I have found some kind of workaround: if I ignore() QEvent::TabletMove events, they get transformed into mouse event, so I only have significant mouseevent instead.
  • Save a QString to sqlite and fetch it back?

    2
    0 Votes
    2 Posts
    2k Views
    G
    I would recommend to use Qt's SQL classes for storing and retrieving data. They should handle the conversion pretty good and you can operate on QStrings directly. The SQLite driver of Qt should be available with all binary installations.
  • [SOLVED] Non-Latin Unicode Strings Not Showing

    2
    0 Votes
    2 Posts
    3k Views
    M
    [quote author="rufus359" date="1308781208"]UPDATE: Apparently Qt is not able to find the fonts on my machine and insists on using its own. Creating a symbolic link to a font that supports Japanese characters in the "[QtDir]/lib/fonts" folder solved the problem.[/quote] Cheers for the update, and welcome to the devnet :)