Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Call a slot in QWidget promoted class

    3
    0 Votes
    3 Posts
    3k Views
    B
    Resolved! I put ShowImage as a public method.
  • Thread-GUI communication

    26
    0 Votes
    26 Posts
    19k Views
    JKSHJ
    [quote author="NullCoding" date="1351259018"]Odd thing is, each thread seems to do everything three times.[/quote]Let's have a look at your code [quote]Also, the GUI locks up. I thought by using separate threads, I would be avoiding exactly that.[/quote]Is it just the GUI, or your whole machine? If it's the latter, it just means your laptop doesn't have enough grunt, and no amount of multithreading will help. [quote]All I'm trying to do is update the GUI as the tests are in progress in another thread. Is that too much to ask? Something tells me Qt doesn't really want to do that. It leaves the GUI accessible, but very very laggy.[/quote]How regularly is the GUI getting updated?
  • QSsl client + server, working example

    2
    0 Votes
    2 Posts
    7k Views
    L
    I found a working server example: @ m_socket = new QSslSocket(this); m_socket->setSocketDescriptor(handle); m_socket->setProtocol(QSsl::SslV3); QByteArray key; QByteArray cert; QFile file_key("../ssl/server.key"); if(file_key.open(QIODevice::ReadOnly)) { key = file_key.readAll(); file_key.close(); } else { qDebug() << file_key.errorString(); } QFile file_cert("../ssl/server.crt"); if(file_cert.open(QIODevice::ReadOnly)) { cert = file_cert.readAll(); file_cert.close(); } else { qDebug() << file_cert.errorString(); } //qDebug() << key + "\n" + cert; QSslKey ssl_key(key, QSsl::Rsa); QSslCertificate ssl_cert(cert); m_socket->setPrivateKey(ssl_key); m_socket->setLocalCertificate(ssl_cert); m_socket->startServerEncryption(); @ This example works fine. Now how can I avoid certificate sending to client? I'd like to have the certificate already available to the client code so that it can use that certificate to communicate with server .
  • Read/Write Excel

    2
    0 Votes
    2 Posts
    1k Views
    P
    hi Peter, you can go through the link "Qt and MS Excel ":http://qt-project.org/forums/viewthread/13656
  • Maximized window goes up and hides the QMenuBar while demaximizing

    1
    0 Votes
    1 Posts
    730 Views
    No one has replied
  • Setting Icon to Application

    4
    0 Votes
    4 Posts
    2k Views
    C
    "Setting the Application Icon":http://qt-project.org/doc/qt-4.8/appicon.html
  • MOC and Qt Creator?

    5
    0 Votes
    5 Posts
    10k Views
    U
    You are right, it works much better with : @ o1.setObjectName("op1"); @ I guess it's time for me to do deeper reading on the priority system. Here i mixed up the object name and the instance name. Thanks again Sierdzio and Chris.
  • How to print formatted text on dot matrix printer?

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Scalability of QTimers and guarantee of clicks

    1
    0 Votes
    1 Posts
    820 Views
    No one has replied
  • Is there way to make a line in Label widget?

    2
    0 Votes
    2 Posts
    1k Views
    A
    Subclass QLabel, and reimplement its paintEvent instead of the one of your main window. Then, you can simply overpaint the line directly on the widget, instead of on the image. The problem with the code above, is that you create the painter on the this object: the MainWindow itself. If you wanted to paint on the image, you should have created it on the Image object. However, I don't get why you first create an image at all, only to convert it to a pixmap a few lines later.
  • Solved:How to implement lastScenePos()?

    6
    0 Votes
    6 Posts
    6k Views
    R
    Thank you very much issam and rcari. It's done well: @ void MyItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { if(event->button()==Qt::LeftButton){ myMouse_koordinat = event->buttonDownScenePos (Qt::LeftButton); qDebug() << myMouse_koordinat.x(); } update(); QGraphicsItem::mousePressEvent(event); } @
  • How to add sound when window opens?

    6
    0 Votes
    6 Posts
    3k Views
    M
    Using PlaySound is straight forward: @#include <Windows.h> #include <MMSystem.h> PlaySound(MAKEINTRESOURCE(IDR_WAVE_FOO), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC)@ Here IDR_WAVE_FOO is the Resource Id of the Wave file we want to play. But this refers to Win32 resources, which are completely separate from Qt's resource system. But both can be used in the same binary just fine. But if you rneed something that really works platfrom-independant, you might call MPlayer as an external process via QProcess. You need a separate MPlayer binary for each platfrom, but that shouldn't be a problem...
  • Maintaining fixed aspect ratio for a widget

    4
    0 Votes
    4 Posts
    2k Views
    P
    I finally gave up on heightForWidth and am now trying to accomplish this with QResizeEvent. If I re-implement it for the widget, it only controls the resizing of the contents of the sub-window, not the sub-window's frame. When I do it for the sub-window (i.e., in a class inheriting QMdiSubWindow), it has no effect! Someone, please throw me a line; I'm running out of ideas.... [EDIT -- After more testing, I realized that I've got a pointer problem: QMdiArea expects type QMdiSubWindow, so I used an unsafe cast to get it to accept my new class. That means I have a base-class pointer directed at an instance of a derived class, which I think explains why my resize code isn't executing. But I'm not sure how I can get around this. Do I have to re-impement QMdiArea as well?]
  • QComboBox popup

    1
    0 Votes
    1 Posts
    907 Views
    No one has replied
  • QStateMachine and dependent properties

    1
    0 Votes
    1 Posts
    820 Views
    No one has replied
  • How to toggle widget "always on top"

    2
    0 Votes
    2 Posts
    3k Views
    C
    I quickly noticed that i was actually trying to turn it on with the code above. Upon further investigation, I found that the flag I was trying to unset isn't set at all in the first place, so unsetting it obviously didn't help. Is there a 'right way' to set a widget (dialog) to not stay on top?
  • Reading contents from memory

    2
    0 Votes
    2 Posts
    975 Views
    T
    Just access the struct in the same way you do in C.
  • [SOLVED]QGraphicsItem, QMatrix and children

    4
    0 Votes
    4 Posts
    2k Views
    J
    @pedro79 Thanks. You solution works :) . @issam No I haven't. But due to ugly outcome of a scale ( if it's scaled by x twice and once by y, borders etc are extremly ugly as one is thicker than another etc...), I used my solution. Marked as solved. Regards, Jake
  • [Solved] QtSerialPort and threading

    7
    1 Votes
    7 Posts
    11k Views
    JKSHJ
    Good to hear :) Please edit your original post and add "[Solved]" to the title
  • Qt Layout problem

    5
    0 Votes
    5 Posts
    2k Views
    L
    Hi Gerolf, could you explain what exactly you mean by custom positioning? Thanks