Advertisement
Guest User

Avoid activate & focus when clicking on window

a guest
Sep 11th, 2013
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. MainWindow::MainWindow(QWidget *parent) :
  2.     QMainWindow(parent),
  3.     ui(new Ui::MainWindow)
  4. {
  5.     ui->setupUi(this);
  6.  
  7.     QWidget *qw = new QWidget();
  8.  
  9.     qw->setFocusPolicy(Qt::NoFocus);
  10.     qw->setAttribute(Qt::WA_ShowWithoutActivating);
  11.  
  12.     QPushButton *but = new QPushButton("hello",qw);
  13.  
  14.     qw->show();    
  15.     but->show();
  16.  
  17.     connect(but,SIGNAL(clicked()),this,SLOT(ev()));
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement