How can we just display image if we don't have any base widget?

  • When i will run program I want to just display image not any window how can i do it?

  • I think you can't.
    But you can display a frameless window
    with setWindowFlags(Qt::FramelessWindowHint) and you won't see any border.

  • I think something like this:
    @#include <QApplication>
    #include <QLable>
    #include <QPixmap>

    int main( int argc, char* argv[] )
    QApplication app( argc, argv );
    QLabel imageLabel;
    imageLabel.setPixmap( QPixmap( "/path/to/your/image" ) );;
    return app.exec();

  • You cannot display anything without a window, but you can display a window without a frame (and I assume this is what you want to achieve) by setting the Qt::FramlessWindowHint flag.
    int main(int argc, char *argv[])
    QApplication a(argc, argv);

    QLabel label;
    return a.exec(&#41;;

    Brain to terminal. Not tested. Exemplary.

  • As said dmcr, if you want framelesswindow just replace 8'th line with:
    @QLabel imageLabel( 0, Qt::FramelessWindowHint );@

  • Thank you.........

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.