hi,
Thanks, I tried it does not seem bad, but its processor usage is huge
how about this, install a eventfilter and start the timer only at the window move event.
MainWindow
::MainWindow(QWidget *parent
){
bMove=false;
connect(&t,SIGNAL(timeout()),this,SLOT(Trans()));
t.setInterval(50);
installEventFilter(this);
}
{
bMove=false;
{
bMove=true;
if(!t.isActive())
{
t.start();
}
}
}
void MainWindow::Trans()
{
if(bMove)
{
//make window transparent
}
else
{
t.stop();
//make window normal
}
}
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
bMove=false;
connect(&t,SIGNAL(timeout()),this,SLOT(Trans()));
t.setInterval(50);
installEventFilter(this);
}
bool MainWindow::eventFilter(QObject *obj, QEvent *evt)
{
bMove=false;
if(evt->type()==QEvent::Move)
{
bMove=true;
if(!t.isActive())
{
t.start();
}
}
}
void MainWindow::Trans()
{
if(bMove)
{
//make window transparent
}
else
{
t.stop();
//make window normal
}
}
To copy to clipboard, switch view to plain text mode
not a straight forward solution, but hope it helps,
bala
Bookmarks