Results 1 to 4 of 4

Thread: Resize Image Background in QMainWindow / Best way to make a Checkers Game

  1. #1
    Join Date
    Mar 2014
    Posts
    27
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Resize Image Background in QMainWindow / Best way to make a Checkers Game

    Hi, I have an image background and a palette, I set the image to the palette and then, I set a this palette to the QMainWindow.
    1st Question ----------------------------------------------------------------------
    The thing here is even when I use this:
    background = new QPixmap(":Local/WoodenBack.png");
    background->scaled(this->size(),Qt::IgnoreAspectRatio);
    Rhe size of the Image remains the default size and the window shows just a half of it.
    Example: Image size 600X600 / Window size 300X300

    2nd Question -----------------------------------------------------------------------

    Im going to make a Checker Game, its not the big deal, should I use QLabels using QMainWindow? I worked with QGraphicsScene and QGraphicsView before, and now I want to try something different. This its just an easy project (The checkers Game).

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Resize Image Background in QMainWindow / Best way to make a Checkers Game

    Quote Originally Posted by vitaR View Post
    Rhe size of the Image remains the default size and the window shows just a half of it.
    Example: Image size 600X600 / Window size 300X300
    What do you do with the result of the scaling operation? I.e. the pixmap returned by scaled()?

    Quote Originally Posted by vitaR View Post
    Im going to make a Checker Game, its not the big deal, should I use QLabels using QMainWindow? I worked with QGraphicsScene and QGraphicsView before, and now I want to try something different. This its just an easy project (The checkers Game).
    For this kind of interface the choice of QGraphicsView is a good one.
    If you want to try something different I'd rather go for QtQuick instead of widgets.

    Cheers,
    _

  3. #3
    Join Date
    Mar 2014
    Posts
    27
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Resize Image Background in QMainWindow / Best way to make a Checkers Game

    Thanks for reply, yeah, this does nothing.

    But there is no problem going for QWidgets? I mean could be difficult while moving pieces or any other thing?
    I can try QtQuick in other time, the reason is that I have only 15 days to do this game, not enought time to learn anything else.
    Thanks for the reply again.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Resize Image Background in QMainWindow / Best way to make a Checkers Game

    Should be doable with widgets.
    Not as nicely as with graphics view but possible.

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    vitaR (3rd July 2014)

Similar Threads

  1. QMainWindow image background and QScrollArea fail.
    By kuko in forum Qt Programming
    Replies: 1
    Last Post: 19th August 2012, 18:22
  2. Replies: 3
    Last Post: 13th November 2011, 08:12
  3. Replies: 0
    Last Post: 29th September 2011, 09:41
  4. Replies: 2
    Last Post: 22nd November 2009, 05:47
  5. Set background image in QMainWindow
    By superteny in forum Qt Programming
    Replies: 4
    Last Post: 26th May 2009, 05:23

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.