Qt无边框,可移动窗口
时间:2014-05-01 04:14:18
收藏:0
阅读:464
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;}");
评论(0)