Skip to content

General and Desktop

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

    5
    0 Votes
    5 Posts
    21k Views
    EddyE
    this is the code taken from my ui_dialog.h file This should help you out with your code. Look at the red.png line : all the others remain the same. @ QIcon icon; icon.addFile(QString::fromUtf8(":/blue.png"), QSize(), QIcon::Normal, QIcon::On); icon.addFile(QString::fromUtf8(":/blue.png"), QSize(), QIcon::Disabled, QIcon::Off); icon.addFile(QString::fromUtf8(":/blue.png"), QSize(), QIcon::Active, QIcon::Off); icon.addFile(QString::fromUtf8(":/red.png"), QSize(), QIcon::Active, QIcon::On); icon.addFile(QString::fromUtf8(":/blue.png"), QSize(), QIcon::Selected, QIcon::Off); pushButton->setIcon(icon); pushButton->setCheckable(true);@ i really like to do things like this using Qt Designer and see all the options immediately in the dialog.
  • Custom Widget compilation problem

    4
    0 Votes
    4 Posts
    3k Views
    Z
    It is because MS compiler uses symbol visibility rules by default (ie it only exports those symbols that you tell it to). Whereas with GCC you have to explicitly enable this feature by using @ CONFIG += hide_symbols @ If you add the above to your .pro file it will also fail to link on Linux due to unexported symbols. We use this as it reduces the number of symbols exported in our libs and hence slightly improves application start up time and keeps the private parts of our API private.
  • How to I transfer file with size more than 65KB?

    7
    0 Votes
    7 Posts
    6k Views
    K
    Well, if you start the discussion on how to do best. The question is also, do you really want to send just a big file? For a couple of 100 kB that is acceptable. For a couple of MB it might make sense to spend a little more thinking. Memory is not as expensive anymore as it was, but ultimately one is always reaching the boundaries. So cutting the file into chunks on both is certainly a good thing to think about.
  • [Solved] Signals and Slots help needed

    6
    0 Votes
    6 Posts
    3k Views
    A
    Hi All, I solved it out. It was failing because of incorrect declarations. The final code is : widget.h @class Widget : public QWidget { Q_OBJECT public : Widget(QWidget *parent = 0); private slots: void buttonClicked(); private: QLineEdit *enterjobid; QPushButton *viewbutton; QTextBrowser *jobmessagebrowser; }; @ widget.cpp @Widget::Widget(QWidget *parent) :QWidget(parent) { QVBoxLayout *mainLayout = new QVBoxLayout; QHBoxLayout *row1 = new QHBoxLayout; QLabel *jobid = new QLabel(tr("Enter Job ID")); enterjobid = new QLineEdit; row1->addWidget(jobid); row1->addWidget(enterjobid); QHBoxLayout *row2 = new QHBoxLayout; viewbutton = new QPushButton(tr("View Job Messages")); QPushButton *clearbutton = new QPushButton(tr("Clear")); row2->addWidget(viewbutton); row2->addWidget(clearbutton); jobmessagebrowser = new QTextBrowser; mainLayout->addLayout(row1); mainLayout->addLayout(row2); mainLayout->addWidget(jobmessagebrowser); setLayout(mainLayout); connect (clearbutton,SIGNAL(clicked()), enterjobid,SLOT(clear())); connect (viewbutton,SIGNAL(clicked()), this ,SLOT(buttonClicked())); } void Widget::buttonClicked() { connect (viewbutton,SIGNAL(clicked()), enterjobid,SLOT(selectAll())); //some work } @ Hope this helps out someone. Thanks.
  • QList<QPixmap> 'index out of range'

    8
    0 Votes
    8 Posts
    6k Views
    Z
    To see what triggers this type of error you should run it in qt-creator in the debugger then click on each higher function in the call stack and inspect the local variables to see what causes the problem.
  • [SOLVED] [N00b] Memory management in Qt

    12
    0 Votes
    12 Posts
    11k Views
    M
    bq. In that case, I’ll be careful to always declare a parent. Seems like the easiest solution. And, if you do ever delete anything manually, be sure to set the pointer to 0 after the call to delete. It's a good, safe practice.
  • [solved]QRegExp

    6
    0 Votes
    6 Posts
    4k Views
    S
    While I think @"[0-9a-fA-F]{2},[0-9a-fA-F]{2},[0-9a-fA-F]{2}"@ will be a better choice, your expression works for me with Regexp and Regexp2 syntaxes. Setting greedy mode to on means set minimal to of...;) you should: @ re.setMinimal(false); @
  • 0 Votes
    3 Posts
    5k Views
    L
    You have to manually hide the tray icon (for example at the closeEvent of the main window). @ void MainWidget::closeEvent(QCloseEvent* event) { _systemTrayIcon->hide(); event->accept(); } @ ... will do the trick.
  • Qt 4.8 (origin/master) documentation for src/plugins/platforms/*

    5
    0 Votes
    5 Posts
    4k Views
    K
    uhm ok thanks :)
  • Qml, anchors and rotating

    5
    0 Votes
    5 Posts
    4k Views
    S
    no, it is not scaling, but rotating...
  • Convert from int to hex

    4
    0 Votes
    4 Posts
    28k Views
    Z
    @ lineEdit_7->setText( QString::number( c.red(), 16 ) ); @
  • QTcpServer, QAbstractSocket

    13
    0 Votes
    13 Posts
    9k Views
    G
    Both applications just open a server listening on ports 9999 and 10000. None of the applications is actually trying to connect to a server. As koahnig already pointed out, have a look at the fortune server app, it demonstrates what you want.
  • QtGUI::QApplication and QtCore::QCoreApplication::init() ?

    9
    0 Votes
    9 Posts
    7k Views
    G
    No. All QApplication constructors call a QCoreApplication constructor which in trun calls init(). qt_startup_hook is implemented in qcoreapplication.cpp - I don't know how one is supposed to replace the object code for that with one's own version. It does not help to make a [[Doc:QApplication]] or [[Doc:QCoreApplication]] subclass, as qt_startup_hook is an extern "C" function and therefore is not subject to method polymorphism!
  • 64bit osx (part II) linking

    6
    0 Votes
    6 Posts
    4k Views
    G
    If you do not setup anything, then the default name mangling is used. If you have a C library that is usesful from C++ as well, it is good practice to put that extern stuff into the header of your libraray. The usual pattern is: @ #ifdef __cplusplus extern "C" { #endif // your actual header files goes here #ifdef __cplusplus } #endif @ See the "C++ FAQ on 'How to mix C and C++'":http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html for some more details. Unfortunately there is no easy way to tell if the header has the "extern" other than actually looking into it.
  • QFutureWatcher, signal paused()

    3
    0 Votes
    3 Posts
    3k Views
    M
    UUps, I wrote some slots not correct, so they didn't exist of course. Now I fixed it, and I get the paused signal. But now I'm totally confused, because it is very late. My output is now: Action: Click Start and wait some seconds. Output: Item 0 ready. (ok), Item 1 ready. (ok) Action: pushbutton_2(Pause) clicked first time Output: no output???? Action: wait some secs. Output: no output, calculation seems to be stopped (ok) Action: pushbutton_2(Pause) clicked second time Output: resumed (ok), paused (why now?) Action: wait some secs. Output: Item 2 ready, Item 3 ready (ok, calculation is running)
  • Changing the height of the tabbar in a qtabwidget

    3
    0 Votes
    3 Posts
    5k Views
    S
    You can also try using "QApplication::setGlobalStrut()":http://doc.qt.nokia.com/latest/qapplication.html#globalStrut-prop. This sets the minimum size a widget can be, and is helpful when making an application more touch screen friendly.
  • Jalali calender

    12
    0 Votes
    12 Posts
    7k Views
    S
    Ok. I'm going to write without QObject. thanks
  • Is it possible to delay load QtGui4.dll in Windows?

    18
    0 Votes
    18 Posts
    14k Views
    F
    Thanks guys, I would like to write a proxy to wrap my plugin. I think it would be the easiest way to solve my problem.
  • Transparent Window in kde

    3
    0 Votes
    3 Posts
    4k Views
    G
    reopened due to user request
  • [SOLVED] Eliminating main window transition (resize) "jump"

    4
    0 Votes
    4 Posts
    2k Views
    L
    Glad I could help, also could you add [Solved] in front of the title of this thread (by editing the first post)?