Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • [SOLVED]Custom TreeView storing objects of different classes.

    6
    0 Votes
    6 Posts
    6k Views
    S
    Volker, Thanks for you help and support, I tried with that approach but didnt get the result as when i cast the Qt::UserRole it returns 0. So i got other approach. I subclassed both classes Employee and AccountDetails from a Base class. Then I tried the following code and it works @QVariant variant = index.data(Qt::DisplayRole); Employee empInfo = dynamic_cast<Employee>((Base )variant.value<void>()); AccountDetails accInfo = dynamic_cast<AccountDetails>((Base )variant.value<void>()); if(empInfo!=NULL) { //paint red } if(accInfo!=NULL) { //paint green } @ Thanks for your time :)
  • Re-sizing of a icon within a QTableWidgetItem

    3
    0 Votes
    3 Posts
    4k Views
    S
    Hi, If we add a pixmap to the QTableWidgetItem the cell of the TableWidget displays the icon as well as the text. In the above case the text value is empty. In order to check u can double click your icon cell and see that you can edit the text. For the above requirement one approach can be to create a delegate and override the paint() method then set the delegate to the TableWidget Eg: .h @class TableDelegate : public QStyledItemDelegate { Q_OBJECT public: explicit TableDelegate(QObject *parent = 0); void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; };@ .cpp @void TableDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { //here you can write the logic for painting each row with different color gradients. if(index.column()==1) painter->fillRect(option.rect,Qt::red); //painting the whole cell if column count ==1 }@ then in the constructor of your class you can give: @delegate = new TableDelegate(); ui->tableWidget->setItemDelegate(delegate);@ You can also make the color column as non-editable. Regards Soumitra
  • [solved] QFileDialog and cancel button

    4
    0 Votes
    4 Posts
    15k Views
    R
    Thank you it works! I need this because I'm adding a widget at the end of my QFileDialog layout...
  • Qt+boost+Wt = problems...

    4
    0 Votes
    4 Posts
    2k Views
    G
    For what architecture did you build the boost an Wt libraries? The universal binaries must at least contain every architecture you build your application for.
  • Debugging problem...

    2
    0 Votes
    2 Posts
    2k Views
    D
    CDB is part of Windows WDK and SDK now, so you can simply download and install WDK or SDK.
  • Accessing widgets from my class

    29
    0 Votes
    29 Posts
    12k Views
    F
    Works like a charm. Thanks for all the help!
  • [solved] XML model?

    5
    0 Votes
    5 Posts
    4k Views
    T
    Ok, Thank you, that's what I wanted to know. Best regards Richard
  • How to show hidden item

    9
    0 Votes
    9 Posts
    5k Views
    N
    lol dont use it for everything though. It's just for code hence why they're "Code tags" :)
  • SFML2 +QtCreator + MacOSX

    4
    0 Votes
    4 Posts
    4k Views
    P
    I solve the problem on mac, but on windows i cant copy all DLLS, can you see the problem? The solution is in repository of the project. All is here: https://qt-project.org/forums/viewthread/16580/
  • Focus application for mac

    4
    0 Votes
    4 Posts
    2k Views
    M
    This is indeed a rather complicated way to call "raise()" :-)
  • Simple QtDBus question

    2
    0 Votes
    2 Posts
    1k Views
    M
    Well, the ChatAdaptor object simply gets a parent object, I suppose. In the case you have posted, it is the ChatMainWindow widget. It does not need to be a QWidget inherited class, QObject is enough. Note how the pointer returned by "new ChatAdaptor(this)" is never stored anywhere. This is because the object will be deleted when the parent is deleted. In a non-GUI application, you can define a class inheriting QObject, and create the ChatAdaptor object and the QDBusConnections in it's constructor the same way. The QDBus functionality does not depend on the parent being a widget.
  • [Solved] Am i being stupid here?

    7
    0 Votes
    7 Posts
    2k Views
    S
    Thanks for all the advice guys, but i turned out to be none of the suggested ideas so I followed gramo's advice and made the appropriate changes.
  • [SOLVED] Trying to Run GlovePIE with parameters

    7
    0 Votes
    7 Posts
    4k Views
    M
    Done, thanks for the reminder!
  • [SOLVED]About restoring the Mainwindow not for the first time

    4
    0 Votes
    4 Posts
    2k Views
    M
    [quote author="MuldeR" date="1335282358"]Well, either store some "FirstRun" flag in your QSettings object, just like you store the other options. ...or set a reasonable default value for the "size" option. @QSize defaultSize(800, 600); //Adjust default as needed! resize(settings.value("size", defaultSize).toSize()); //Pass a default to QSettings::value()@[/quote] That's a fine approach too. For the record, I had used the valid test in order to be able to create a block of code that he could use to do any other "first-time" initialization. They're all valid solutions, though.
  • [Solved] QSslSocket Error (SSLv2)

    3
    0 Votes
    3 Posts
    33k Views
    S
    SSLv2 is broken, so some linux distributions configure it out of openssl 1.0.0 builds. You can use QSsl::SecureProtocols to enable the SSL versions which are considered secure as of the Qt release. If the web server is configured to use SSLv2, it may need a security upgrade.
  • [SOLVED]close form(QDialog) when moved to background

    2
    0 Votes
    2 Posts
    1k Views
    M
    Use @setWindowFlags(Qt::Popup);@ for your dialog
  • Delimiting character in QString.readLine()

    4
    0 Votes
    4 Posts
    8k Views
    A
    Yes, split() is indeed the function I am looking for, thanks!
  • Cannot convert QString to int in assignment

    7
    0 Votes
    7 Posts
    12k Views
    M
    Volker is correct. This code works fine but I did the mistake of taking as fact that the error did come up with the above code.This could be created in situation such as @int iTime; QString newline; bool ok; iTime = newline(10)@ where by mistake you missed to use the member function and used QString constructor. I must read more carefully and imagine less I guess.
  • Qt/MFC Event Loop - stop MFC receiving event?

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • [Solved]Automatic resize to fit the elements in a Dialog

    6
    0 Votes
    6 Posts
    4k Views
    T
    Thanks a lot!!! @resize(minimumSizeHint());@ did it :) I'm grateful!