Results 1 to 6 of 6

Thread: Image as window form

  1. #1
    Join Date
    Jul 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Image as window form

    Hello, I want to make window frame using some picture. Window shouldn't have borders, titlebars, etc. It also should be hidden from active windows list (in taskbar).

    Second part of question I did with:

    Qt Code:
    1. this->setAttribute(Qt::WA_NoSystemBackground);
    2. this->setAttribute(Qt::WA_QuitOnClose);
    3.  
    4. this->setAutoFillBackground(true);
    5.  
    6. this->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool);
    To copy to clipboard, switch view to plain text mode 
    for new class which inherits QMainWindow. It's hidden, for example, at gnome taskbar, but in Awn (awant windows navigator) I seed it in the list of active windows .

    What about first part. I did this some time ago with QRegion, QPixmap and mask in overloaded paintEvent. I've lost the code. Can you help me with this?

    I tried the code like:
    Qt Code:
    1. void MainWindow::paintEvent(QPaintEvent * event)
    2. {
    3. QPainter painter(this);
    4.  
    5. QPixmap pixmap = QPixmap();
    6. pixmap.load("/home/my_image.jpg");
    7.  
    8. painter.drawPixmap(event->rect(), pixmap);
    9. }
    To copy to clipboard, switch view to plain text mode 
    But I see my picture and black rectangle under it.
    Last edited by Ockonal; 3rd April 2011 at 08:33.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Image as window form

    Try this:
    http://www.qtcentre.org/wiki/index.p...e=ARGB-Widgets

    But why do you want to throw out all of the desktop usability?

  3. #3
    Join Date
    Jul 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Image as window form

    Quote Originally Posted by tbscope View Post
    Try this:
    http://www.qtcentre.org/wiki/index.p...e=ARGB-Widgets
    But why do you want to throw out all of the desktop usability?
    I want to do that under Linux.
    I'm making some desktop widget, thats why I want to remove all that desktop usability.

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Image as window form

    Quote Originally Posted by Ockonal View Post
    I want to do that under Linux.
    I'm making some desktop widget, thats why I want to remove all that desktop usability.
    There are standard API's to do that. Example: google gadgets, KDE Plasma widgets

  5. #5
    Join Date
    Jul 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Image as window form

    Quote Originally Posted by tbscope View Post
    There are standard API's to do that. Example: google gadgets, KDE Plasma widgets
    I know, but I want to do this directly with Qt. Just don't ask why do I want this.

  6. #6
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Image as window form

    Quote Originally Posted by Ockonal View Post
    I know, but I want to do this directly with Qt. Just don't ask why do I want this.
    Why do you want to do this?

Similar Threads

  1. Qt form to bitmap image .. How to
    By Ratheendrans in forum Qt Programming
    Replies: 2
    Last Post: 24th November 2010, 13:22
  2. setting an image on the form
    By Yayati.Ekbote in forum Newbie
    Replies: 6
    Last Post: 15th March 2010, 11:39
  3. [Qt4.1] How to insert an image inside a Form?
    By Gonzalez in forum Qt Tools
    Replies: 5
    Last Post: 23rd September 2008, 11:20
  4. How to insert an image in background of a Form?
    By awanish_jmi in forum Qt Tools
    Replies: 2
    Last Post: 8th August 2008, 10:52
  5. Replies: 7
    Last Post: 13th November 2006, 15:44

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.