Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Translucent backdrop in my mainwindow
Forum Updated to NodeBB v4.3 + New Features

Translucent backdrop in my mainwindow

Scheduled Pinned Locked Moved Mobile and Embedded
11 Posts 3 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #2

    I saw the the post on http://doc.qt.digia.com/qq/qq16-background.html
    saw the command and windowsopacity

    setAttribute(Qt::WA_TranslucentBackground, true);

    I am not trying to make the windows transparent, i am trying to make the widgets transparent. Any help, appreciated.

    1 Reply Last reply
    0
    • McLionM Offline
      McLionM Offline
      McLion
      wrote on last edited by
      #3

      Are you on Windows? If yes, did you also set @QMainWindow(parent,Qt::FramelessWindowHint)@

      You may need to share some more details.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        houmingc
        wrote on last edited by
        #4

        can you kindly direct me to any guide?
        I am trying to create a background for my mainwindow.

        1 Reply Last reply
        0
        • McLionM Offline
          McLionM Offline
          McLion
          wrote on last edited by
          #5

          What exactly is it that you want? Transparent background of main window? Transparent background of widgets? You are talking about different things. What did you try for which target?

          1 Reply Last reply
          0
          • H Offline
            H Offline
            houmingc
            wrote on last edited by
            #6

            Sorry for the bad communication.
            My purpose is to paste a picture as background on the main window so that it looks more lively.

            thought Qt should comes with this features

            1 Reply Last reply
            0
            • McLionM Offline
              McLionM Offline
              McLion
              wrote on last edited by
              #7

              Never tried this ... you should be able to add a background image via a StyleSheet. By code or in Designer select StyleSheet on the respective MainWindow (or CentralWidget or .. depends on your ui) and add a resource as background image.

              1 Reply Last reply
              0
              • H Offline
                H Offline
                houmingc
                wrote on last edited by
                #8

                I tried adding it inside using "edit Style Sheet" in qt SDK
                it feedback nvalid Style Sheet in red
                I tried this method before,

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andreyc
                  wrote on last edited by
                  #9

                  Could you show a style sheet expression that you were using.

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    houmingc
                    wrote on last edited by
                    #10

                    I use the below line to set my pushbutton color

                    ui->pushButton->setStyleSheet("* { background-color: rgb(255,125,100) }");

                    1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      houmingc
                      wrote on last edited by
                      #11

                      //How to add a picture to mainwindow

                      below link has the answer
                      http://stackoverflow.com/questions/4458201/unable-to-set-the-background-image-in-qt-stylesheet#

                      In the constructor add:
                      setStyleSheet("background-image:url(:/File/abc.png);");

                      where under resources, File.qrc /File/and your files.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved