Qt无边框,可移动窗口




QPoint dragPosition;




void MainWindow::mousePressEvent(QMouseEvent *event)
{
if(event->button()==Qt::LeftButton)
{
dragPosition=event->globalPos()-frameGeometry().topLeft();
event->accept();
}


}

void MainWindow::mouseMoveEvent(QMouseEvent *event)
{
if(event->buttons() == Qt::LeftButton)
{
move(event->globalPos()-dragPosition);
event->accept();
}

}


setStyleSheet("QProgressBar{border:none;background:rgb(210,225,240);border-radius:3px;text-align:center;}"
"QProgressBar::chunk{background:rgb(60,140,220);border-radius:3px;}");





posted @ 2014-04-30 20:02  Android开发8585  阅读(467)  评论(0编辑  收藏  举报