mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
update: popup dailog style
This commit is contained in:
parent
470747cb89
commit
4958b718b1
@ -49,7 +49,7 @@ DSDialog::DSDialog(QWidget *parent, bool hasClose):
|
||||
}
|
||||
|
||||
DSDialog::DSDialog(QWidget *parent, bool hasClose, bool bBaseButton) :
|
||||
QDialog(parent), //must be null, otherwise window can not able to move
|
||||
QDialog(NULL),
|
||||
m_bBaseButton(bBaseButton)
|
||||
{
|
||||
(void)parent;
|
||||
|
@ -34,7 +34,7 @@ namespace pv {
|
||||
namespace dialogs {
|
||||
|
||||
DSMessageBox::DSMessageBox(QWidget *parent,const char *title) :
|
||||
QDialog(NULL) //must be null, otherwise window can not able to move
|
||||
QDialog(parent)
|
||||
{
|
||||
(void)parent;
|
||||
_layout = NULL;
|
||||
|
@ -197,7 +197,8 @@ void TitleBar::mousePressEvent(QMouseEvent* event)
|
||||
|
||||
if (!bTopWidow || bClick ){
|
||||
_moving = true;
|
||||
_startPos = event->globalPos() - _parent->frameGeometry().topLeft();
|
||||
_clickPos = event->globalPos();
|
||||
_oldPos = _parent->pos();
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
@ -206,9 +207,11 @@ void TitleBar::mousePressEvent(QMouseEvent* event)
|
||||
}
|
||||
|
||||
void TitleBar::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if(_moving){
|
||||
_parent->move(event->globalPos() - _startPos);
|
||||
{
|
||||
if(_moving){
|
||||
int x = _oldPos.x() + (event->globalPos().x() - _clickPos.x());
|
||||
int y = _oldPos.y() + (event->globalPos().y() - _clickPos.y());
|
||||
_parent->move(x, y);
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
|
@ -68,11 +68,12 @@ protected:
|
||||
QToolButton *_closeButton;
|
||||
QLabel *_title;
|
||||
|
||||
bool _moving;
|
||||
bool _isTop;
|
||||
bool _hasClose;
|
||||
QPoint _startPos;
|
||||
QWidget *_parent;
|
||||
bool _moving;
|
||||
bool _isTop;
|
||||
bool _hasClose;
|
||||
QPoint _clickPos;
|
||||
QPoint _oldPos;
|
||||
QWidget *_parent;
|
||||
};
|
||||
|
||||
} // namespace toolbars
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <assert.h>
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
#include "../dsvdef.h"
|
||||
|
||||
//QMessageBox::information(NULL, "Title", "Content",QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||
//QMessageBox::information(NULL, "Title", "Content",QMessageBox::Yes|QMessageBox::No);
|
||||
@ -38,6 +39,10 @@ void MsgBox::Show(const char *title, const char *text, QWidget *parent)
|
||||
str.append("\n");
|
||||
str.append(text);
|
||||
|
||||
if (parent == NULL){
|
||||
parent = app::get_app_window_instance(NULL, false);
|
||||
}
|
||||
|
||||
pv::dialogs::DSMessageBox msg(parent, title);
|
||||
msg.mBox()->setText(str);
|
||||
// msg.mBox()->setInformativeText(QString(text));
|
||||
@ -54,6 +59,10 @@ bool MsgBox::Confirm(const char *text, QWidget *parent)
|
||||
str.append("\n");
|
||||
str.append(text);
|
||||
|
||||
if (parent == NULL){
|
||||
parent = app::get_app_window_instance(NULL, false);
|
||||
}
|
||||
|
||||
pv::dialogs::DSMessageBox msg(parent, "Question");
|
||||
msg.mBox()->setText(str);
|
||||
msg.mBox()->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
|
Loading…
x
Reference in New Issue
Block a user