Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • [SOLVED]QLibrary - load and using DLL

    9
    0 Votes
    9 Posts
    8k Views
    P
    Yes, "extern 'C'" working. :) :D Thank you very much.
  • [Solved] setToolTip in QAction menu

    17
    0 Votes
    17 Posts
    16k Views
    A
    The current code handles QEvent::ToolTip in QMenuBar::event. For the menu items, you need to do the same QMenu::event(). Just a side note: As you can see, Qt does not support this use case by default. Do a quick research in your system, how many applications show tooltips like those you want? IMHO menu and menu items should have self-explaining names. If the menu names are good enough, the tooltips are redundant. But that's just my opinion...
  • Problem with transform of pointer

    5
    0 Votes
    5 Posts
    3k Views
    R
    Many thanks for your help, I did not consider object CentralWidget
  • [SOLVED]Write QMAKE replace function

    12
    0 Votes
    12 Posts
    6k Views
    P
    Used in Library project: @include(../../../Project.pri) QT += xml xmlpatterns TARGET = $$setLibraryTarget(Configuration) @ Defined in project include file ( .pri ) @defineReplace(setLibraryTarget){ NAME = $$1 return($$quote(${SYDNEYSTUDIO_PROJECT_NAME}.$$NAME)) }@ Well, when I removed Makefile and wrote is on multi-lines, it works...thanks for help. So solution is, do not write QMAKE function as inline :D :D But, there is another problem with my QMAKE (new thread?)
  • 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