Results 1 to 2 of 2

Thread: Window Background

  1. #1
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Post Window Background

    Hi,
    I have qtembedded 4.4.1. My physical tft size is 800 x 480. I am creating a QGraphicsScene with a background and images ontop of it, no window borders. My background picture image .jpg is 800x480. When I display the background image the window is resized to 796 * 476. So what I see is a very small outline around my picture ( 4 pixel width around). I will try to make the code brief. Here is what I am doing.
    mainwindow class
    class MainWindow : public QGraphicsView [...]
    MainWindow::MainWindow(void)
    setFixedSize(800,480);
    setWindowFlags(Qt::FramelessWindowHint);
    [...]
    void MainWindow::drawBackground(QPainter *painter, const QRectF &rect)
    {
    qDebug() << "exposed rect" << rect;
    QImage image = QImage("images/mainbackground.jpg");
    painter->drawImage(rect,image);
    }
    void MainWindow::resizeEvent(QResizeEvent *event)
    {
    QGraphicsView::resizeEvent(event);
    fitInView(mainWindowScene->sceneRect(), Qt::KeepAspectRatio);
    qDebug() << "newsize" << event->size();
    qDebug() << "oldsize" << event->oldSize();
    }
    My debugging shows this.. So, the qgraphicsview object is resizing the background when it is displayed. I don't know why it is doing this.
    newsize QSize(796, 460)
    oldsize QSize(-1, -1)
    newsize QSize(796, 476)
    oldsize QSize(796, 460)

  2. #2
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Window Background

    fyi. I fixed my problem by adding this function call setFrameStyle(QFrame::NoFrame).

Similar Threads

  1. Error: BadMatch --> what's it?
    By mattia in forum Newbie
    Replies: 4
    Last Post: 9th June 2008, 12:20
  2. Set a window as child at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 26th November 2007, 09:30
  3. Background image for main window widget using css.
    By Enygma in forum Qt Programming
    Replies: 8
    Last Post: 23rd August 2007, 15:40
  4. Replies: 15
    Last Post: 23rd March 2007, 16:16
  5. background colour
    By kw in forum Qt Programming
    Replies: 6
    Last Post: 11th April 2006, 00:44

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
  •  
Qt is a trademark of The Qt Company.