Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt5 cann't display QWidget in Windows7
Forum Updated to NodeBB v4.3 + New Features

Qt5 cann't display QWidget in Windows7

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.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.
  • L Offline
    L Offline
    lvshuchengyin
    wrote on last edited by
    #1

    I use Qt5 to make a application.

    @Mainwindow::Mainwindow(QWidget parent) :
    QWidget (parent),
    ui(new Ui::Mainwindow)
    {
    setWindowFlags(Qt::FramelessWindowHint);
    setAttribute(Qt::WA_TranslucentBackground,true);
    QGraphicsDropShadowEffect
    eff = new QGraphicsDropShadowEffect(this);
    eff->setOffset(0);
    eff->setBlurRadius(4);
    eff->setColor(QColor(0,0,0,255*0.9);
    this->setGraphicsEffect(eff);
    ui->setupUi(this);
    show();
    }@

    It is not display in windows 7 except I let it minimize and show it again, it will display normal, but it works fine in windows XP.
    And when I use Qt4.8.5 , it worked fine both windows 7 and XP.

    How could I correct it?

    I do some work according to the google search to try, but has no effect.

    @setParent(0); // Create TopLevel-Widget
    setAttribute(Qt::WA_NoSystemBackground, true);
    setAttribute(Qt::WA_TranslucentBackground, true);
    setAttribute(Qt::WA_PaintOnScreen);@

    1 Reply Last reply
    0
    • B Offline
      B Offline
      brcontainer
      wrote on last edited by
      #2

      A question about this:
      @
      setAttribute(Qt::WA_PaintOnScreen);
      @

      return "QWidget::paintEngine: Should no longer be called"?

      Qt::WA_PaintOnScreen requires paintEvent

      In .h file:
      @protected:
      virtual void paintEvent(QPaintEvent* evt);@

      In .cpp file:
      @void Mainwindow::paintEvent(QPaintEvent* evt)
      {
      ...
      }@

      Probably adding paintEvent will work.

      QT project: https://github.com/brcontainer/qt-helper

      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