예제 #1
0
void colorDialog::fitDialog() {

  const QSize hint = sizeHint();
  int hintWidth = hint.width();
  int hintHeight = hint.height();

  int newx = geometry().x();
  int newy = geometry().y();

  const int desktopWidth = QApplication::desktop()->width();
  const int desktopHeight = QApplication::desktop()->height();

  bool scrollx = false, scrolly = false;
  if (frameWidth_ + hintWidth > desktopWidth) {
    // make it extend to the right of the screen minus some room to move
    hintWidth = ((desktopWidth - frameWidth_) - newx) - 100;
    scrollx = true;
  }
  if (frameHeight_ + hintHeight > desktopHeight) {
    // make it extend to the bottom of the screen minus some room to move
    hintHeight = ((desktopHeight - frameHeight_) - newy) - 100;
    scrolly = true;
  }
  // if a horizontal scroll bar is going to appear then make room
  if (scrollx && !scrolly) {
    hintHeight += style()->pixelMetric(QStyle::PM_ScrollBarExtent);
    // we may be too big now!
    if (hintHeight + frameHeight_ > desktopHeight) {
      hintHeight = ((desktopHeight - frameHeight_) - newy) - 100;
    }
  }
  else if (scrolly && !scrollx) {
    hintWidth += style()->pixelMetric(QStyle::PM_ScrollBarExtent);
    if (hintWidth + frameWidth_ > desktopWidth) {
      hintWidth = ((desktopWidth - frameWidth_) - newx) - 100;
    }
  }

  const int leftFrameWidth = geometry().x() - x();
  const int rightFrameWidth =
    frameGeometry().width() - width() - leftFrameWidth;
  const int topFrameHeight = geometry().y() - y();
  const int bottomFrameHeight =
    frameGeometry().height() - height() - topFrameHeight;
  if (newx + hintWidth + rightFrameWidth > desktopWidth) {
    newx -= (newx + hintWidth + rightFrameWidth) - desktopWidth;
  }
  if (newx - leftFrameWidth < 0) {
    newx += leftFrameWidth - newx;
  }
  if (newy + hintHeight + bottomFrameHeight > desktopHeight) {
    newy -= (newy + hintHeight + bottomFrameHeight) - desktopHeight;
  }
  if (newy - topFrameHeight < 0) {
    newy += topFrameHeight - newy;
  }
  // sigh... this keeps getting reset somehow
  setMinimumHeight(0);
  setGeometry(newx, newy, hintWidth, hintHeight);
}
UpdatePasswordWidget::UpdatePasswordWidget(const QString &adminAddress, quint16 adminPort, const QString &adminName, const QString &oldPassword, const QString &newPassword, QWidget *parent)
    : QWidget(parent), m_oldPassword(oldPassword), m_newPassword(newPassword)
{
    ui.setupUi(this);

    setWindowFlags(Qt::WindowStaysOnTopHint);

    // Get the size of screen
    QDesktopWidget* desktop = QApplication::desktop();
    QRect rect = desktop->availableGeometry(this);
    int desktopWidth = rect.width();
    int desktopHeight = rect.height();
    int windowWidth = frameGeometry().width();
    int windowHeight = frameGeometry().height();
    //move the window
    move((desktopWidth - windowWidth) / 2, (desktopHeight - windowHeight) / 2);
//        move((desktopWidth - windowWidth), (desktopHeight - windowHeight));


    m_adminAddress = "";
    m_adminPort = 0;

    m_oldPassword = "";
    m_newPassword = "";


    informNewPassword(adminAddress, adminPort, adminName, oldPassword, newPassword);


}
예제 #3
0
    void adjustGeometry(const QRect &newGeometry)
    {
        const int x1 = frameGeometry().left() - geometry().left();
        const int y1 = frameGeometry().top() - geometry().top();
        const int x2 = frameGeometry().right() - geometry().right();
        const int y2 = frameGeometry().bottom() - geometry().bottom();

        setGeometry(newGeometry.adjusted(x1, y1 - m_addressBar->height(), x2, y2));
    }
예제 #4
0
void TicketPopup::popup()
{
  //NOTE: Why before show() the frameGeometry is bigger, and after showing it, it resizes itself?
  move(2000,2000);
  show();
  int x = (QApplication::desktop()->width()/2 )-(frameGeometry().width()/2);
  int y = (QApplication::desktop()->height()/2)-(frameGeometry().height()/2);
  setGeometry(x,y,335,340);
  timer->start();
}
예제 #5
0
void MainFrame::writeSettings()
{
    QSettings settings;

    settings.beginGroup("MainFrame");
    settings.setValue("size", size());
    settings.setValue("pos", pos() +
                      QPoint(geometry().left() - frameGeometry().left(), frameGeometry().right() - geometry().right()));
    settings.endGroup();
}
예제 #6
0
void Korn::moveEvent( QMoveEvent * )
{
	KConfig *config = KApplication::getKApplication()->getConfig();

	config->setGroup("Korn");
	config->writeEntry("PosX", frameGeometry().x(), true);
	config->writeEntry("PosY", frameGeometry().y(), true);
	config->writeEntry("Width",	width(), 	true);
	config->writeEntry("Height",	height(), 	true);
	config->sync();
}
예제 #7
0
void MainWidget::on_pb_setting_clicked()
{
    ++num;
    num %= 2;
    switch(num)
    {
    case 0: break;
    case 1: emit signalCustomContexMenuRequested(frameGeometry().x() + 815,
                                                 frameGeometry().y() + 66);
        break;
    default: break;
    }
}
예제 #8
0
void Widget_Padre::centra_finestra(){
       int width = frameGeometry().width();
       int height = frameGeometry().height();

       QDesktopWidget wid;

       int screenWidth = wid.screen()->width();
       int screenHeight = wid.screen()->height();

       int x=static_cast<int>((screenWidth-width)/2);
       int y=static_cast<int>((screenHeight-height)/2);

       move(x,y);
}
예제 #9
0
void DlgPreferences::moveEvent(QMoveEvent* e) {
    if (m_geometry.length() == 4) {
#ifdef __WINDOWS__
    Q_UNUSED(e);
        m_geometry[0] = QString::number(frameGeometry().left());
        m_geometry[1] = QString::number(frameGeometry().top());
#else
        // Warning! geometry does NOT include the frame/title.
        int offsetX = geometry().left() - frameGeometry().left();
        int offsetY = geometry().top() - frameGeometry().top();
        m_geometry[0] = QString::number(e->pos().x() - offsetX);
        m_geometry[1] = QString::number(e->pos().y() - offsetY);
#endif
    }
}
예제 #10
0
frmNapiProjektUpload::frmNapiProjektUpload(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)
{
    ui.setupUi(this);

    setAttribute(Qt::WA_QuitOnClose, false);

    connect(ui.pbSelectDirectory, SIGNAL(clicked()), this, SLOT(selectDirectory()));
    connect(ui.leSelectDirectory, SIGNAL(textChanged(QString)), this, SLOT(leSelectDirectoryChanged()));
    connect(ui.pbScan, SIGNAL(clicked()), this, SLOT(pbScanClicked()));
    connect(&scanThread, SIGNAL(scanFinished(bool)), this, SLOT(scanFinished(bool)));
    connect(&scanThread, SIGNAL(folderChange(QString)), this, SLOT(folderChange(QString)));
    connect(ui.pbUpload, SIGNAL(clicked()), this, SLOT(pbUploadClicked()));
    connect(&uploadThread, SIGNAL(finished()), this, SLOT(uploadFinished()));
    connect(&uploadThread, SIGNAL(progressChange(int)), ui.pbProgress, SLOT(setValue(int)));
    connect(&uploadThread, SIGNAL(fileNameChange(QString)), this, SLOT(fileNameChange(QString)));
    connect(&uploadThread, SIGNAL(checkingUserPass()), this, SLOT(checkingUserPass()));
    connect(&uploadThread, SIGNAL(invalidUserPass()), this, SLOT(invalidUserPass()));

    if(QFileInfo(GlobalConfig().previousDialogPath()).isDir())
        ui.leSelectDirectory->setText(GlobalConfig().previousDialogPath());

    QRect position = frameGeometry();
    position.moveCenter(QDesktopWidget().availableGeometry().center());
    move(position.topLeft());
}
예제 #11
0
/**************************************************************
 *
 *  update the view frame
 *
 *************************************************************/
void
MainWindow::updateViewFramesPosition()
{
  int h2 = frameGeometry().height();

//  _w3d.move(x() + _w3d.width(), y() + _w3d.width() + height());
}
예제 #12
0
frmProgress::frmProgress(QWidget * parent, Qt::WindowFlags f)
    : QWidget(parent, f)
{
    qRegisterMetaType<QNapiSubtitleInfoList>("QNapiSubtitleInfoList");

    ui.setupUi(this);

    setAttribute(Qt::WA_DeleteOnClose, false);
    setAttribute(Qt::WA_QuitOnClose, false);

    setBatchMode(false);

    connect(&getThread, SIGNAL(fileNameChange(const QString &)),
            ui.lbFileName, SLOT(setText(const QString &)));
    connect(&getThread, SIGNAL(actionChange(const QString &)),
            ui.lbAction, SLOT(setText(const QString &)));
    connect(&getThread, SIGNAL(progressChange(int, int, float)),
            this, SLOT(updateProgress(int, int, float)));
    connect(&getThread, SIGNAL(selectSubtitles(QString, QNapiSubtitleInfoList)),
            this, SLOT(selectSubtitles(QString, QNapiSubtitleInfoList)));
    connect(this, SIGNAL(subtitlesSelected(int)),
            &getThread, SLOT(subtitlesSelected(int)));
    connect(&getThread, SIGNAL(finished()),
            this, SLOT(downloadFinished()));

    QRect position = frameGeometry();
    position.moveCenter(QDesktopWidget().availableGeometry().center());
    move(position.topLeft());
}
예제 #13
0
void ColorPicker::paintEvent (QPaintEvent *event)
{
  QPainter p (this);
  p.fillRect(frameGeometry(), convert (_color));

  QWidget::paintEvent (event);
}
예제 #14
0
void ToyGrid::UpdateMode()
{
	for(WIDGET_LIST::const_iterator i=m_List.begin(); i!=m_List.end(); i++)
		(*i)->SetMode(m_Mode);
	
	switch( m_Mode )
	{
		case ToyWidget::MODE_DEFAULT:
			CloseEditPanel();
			break;
			
		case ToyWidget::MODE_EDIT:
			{
				CreateEditPanel();

				if( m_EditPanel )
				{
					QWidget *pParent = parentWidget();
					if( pParent )
						m_EditPanel->move( mapToGlobal(QPoint(width(),0)) );
					else
						m_EditPanel->move(frameGeometry().topRight() + QPoint(1,0));
					m_EditPanel->show();
					ClipToScreen( *m_EditPanel );
				}
			}
			break;
	}

	UpdateText();
}
예제 #15
0
void TreeComboBox::on_toolButton_clicked()
{
//    QRect parentRect;

    QRect frmGeometry = frameGeometry();
    QWidget* parentWindow = this;
    QPoint pos = this->pos();
    pos = this->parentWidget()->mapToGlobal(pos);
    int posx = pos.x();
    int posy = pos.y();
    QRect rect;
    rect.setX(posx);
    posy = posy + height();
    if ((posy+200) > qApp->desktop()->height()) {
        posy = posy - height() - 200;
    }
    rect.setY(posy);
    rect.setHeight(200);
    rect.setWidth(ui->lineEdit->width());

    _treeView->setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
    _treeView->setGeometry(rect);
    _treeView->show();
    _treeView->activateWindow();
    _treeView->setWindowTitle(tr(""));
    _treeView->setFocus(Qt::PopupFocusReason);
}
예제 #16
0
void QTodoClock::mousePressEvent(QMouseEvent* e)
{
	if(isTopLevel())
		clickPos = e->pos() + QPoint(geometry().topLeft() - frameGeometry().topLeft());

	handleMouseEvent(e);
}
예제 #17
0
void MainWindow::mousePressEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton) {
        m_dragPosition = event->globalPos() - frameGeometry().topLeft();
        event->accept();
    }
}
예제 #18
0
// 两个鼠标事件处理函数实现了部件的拖动
void MusicLrc::mousePressEvent(QMouseEvent *event)
{
    if(acceptEvent){
    if (event->button() == Qt::LeftButton)
        offset = event->globalPos() - frameGeometry().topLeft();
    }
}
예제 #19
0
SMGui::SMGui(QWidget *parent) :
    QMainWindow(parent)
{
    QRect available_geom = QDesktopWidget().availableGeometry();
    QRect current_geom = frameGeometry();
    setGeometry(available_geom.width() / 2 - current_geom.width() / 2,
                            available_geom.height()  - current_geom.height() / 2,
                            current_geom.width()/2,
                            current_geom.height()/2);


    this->setMaximumHeight(400);
    this->setMaximumWidth(300);
    vlayout = new QVBoxLayout;
    vGroup = new QGroupBox;
    vGroup->setLayout(vlayout);

    widgetlayout = new QVBoxLayout;
    centralWidget = new QWidget;

    this->setMaximumWidth(300);
    this->show();
    Logger::getInstance().log("creating GUI", 1);

}
예제 #20
0
bool KFontDialog::eventFilter(QObject *obj, QEvent *event) {
    if(obj == ui->btn_close) {
            if(event->type() == QEvent::Enter){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn-hover.png"));
            }else if(event->type() == QEvent::Leave){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn.png"));
            }else if(event->type() == QEvent::MouseButtonPress){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn-hover.png"));
            }else if(event->type() == QEvent::MouseButtonRelease){
                QMouseEvent *me = (QMouseEvent *)event;
                QLabel *lb = (QLabel *)obj;
                if(me->x() > 0 && me->x() < lb->width() && me->y() > 0 && me->y() < lb->height()){
                    this->close();
                }else{
                    ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeBtn.png"));
                }
            } else {
                return QObject::eventFilter(obj, event);
            }
    }
    if(obj == ui->okBtn ||obj == ui->quitBtn)
    {
        if(event->type() == QEvent::MouseButtonPress)
        {
            QMouseEvent *me = (QMouseEvent *)event;
            dragPos = me->globalPos() - frameGeometry().topLeft();
        }else if(event->type() == QEvent::MouseButtonRelease)
        {
            setWindowOpacity(1);
        }
    }
    return QObject::eventFilter(obj, event);
}
예제 #21
0
void QWidget::setMask(const QRegion& region)
{
    Q_D(QWidget);
    d->createExtra();

    if (region == d->extra->mask)
        return;

    QRegion parentR;
    if (!isWindow())
        parentR = d->extra->mask.isEmpty() ? QRegion(rect()) : d->extra->mask ;

    d->extra->mask = region;

    if (isVisible()) {
        if (isWindow()) {
            d->data.fstrut_dirty = true;
            d->invalidateBuffer(rect());
            QWindowSurface *surface = d->extra->topextra->backingStore->windowSurface;
            if (surface) {
                // QWSWindowSurface::setGeometry() returns without doing anything
                // if old geom  == new geom. Therefore, we need to reset the old value.
                surface->QWindowSurface::setGeometry(QRect());
                surface->setGeometry(frameGeometry());
            }
        } else {
            parentR += d->extra->mask;
            parentWidget()->update(parentR.translated(geometry().topLeft()));
            update();
        }
    }
}
예제 #22
0
MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    /*kozepre teszi a nyito kepernyot*/
    QRect available_geom = QDesktopWidget().availableGeometry();
    QRect current_geom =  frameGeometry();

    setGeometry(available_geom.width() / 2 - current_geom.width() / 2,
        available_geom.height() / 2 - current_geom.height() / 2,
        current_geom.width(),
        current_geom.height());
    /********************************/

    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));    
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(MenTXT()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
    connect(ui->actionBinom, SIGNAL(triggered()), this, SLOT(binom()) );
    connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
    connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(printIt()));

    ui->mainToolBar->addAction(ui->actionSave);
    ui->mainToolBar->addAction(ui->actionPrint);
    ui->mainToolBar->addSeparator();
    ui->mainToolBar->addAction(ui->actionBinom);
    ui->mainToolBar->addSeparator();
    ui->mainToolBar->addAction(ui->actionHelp);

    verzio = "2010-03-03";

    settingClear();

}
void MainWindow::mousePressEvent(QMouseEvent *event)
{
    if (windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen))
        return;
    if (event->button() == Qt::LeftButton) {
        if (isZoomReady) {
            isLeftPressDown = true;
            if (direction != None) {
                releaseMouse();
                setCursor(QCursor(Qt::ArrowCursor));
            }
        } else {
            bool can_move = true;
            if (view && view->scene()) {
                QPointF pos = view->mapToScene(event->pos());
                if (scene->itemAt(pos, QTransform()))
                    can_move = false;
            }
            if (can_move) {
                isLeftPressDown = true;
                movePosition = event->globalPos() - frameGeometry().topLeft();
                event->accept();
            }
        }
    }
}
예제 #24
0
// 两个鼠标事件处理函数实现了部件的拖动
void DesktopLrc::mousePressEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton)
    {
        offset = event->globalPos() - frameGeometry().topLeft();
    }
}
예제 #25
0
bool PersonalChatDlg::eventFilter(QObject *obj, QEvent *event)
{
    if(obj == ui->btn_min){                          //最小化、最大化、关闭按钮换图
            if(event->type() == QEvent::Enter){
                ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton-hover.png"));
            }else if(event->type() == QEvent::Leave){
                ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton.png"));
            }else if(event->type() == QEvent::MouseButtonPress){
                ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton-hover.png"));
            }else if(event->type() == QEvent::MouseButtonRelease){
                QMouseEvent *me = (QMouseEvent *)event;
                QLabel *lb = (QLabel *)obj;
                if(me->x() > 0 && me->x() < lb->width() && me->y() > 0 && me->y() < lb->height()){
                    this->showMinimized();
                }else{
                    ui->btn_min->setPixmap(QPixmap(":/pixmap/image/miniButton.png"));
                }
            } else {
                return QObject::eventFilter(obj, event);
            }
        }
    if(obj == ui->btn_close){                          //最小化、最大化、关闭按钮换图
            if(event->type() == QEvent::Enter){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton-hover.png"));
            }else if(event->type() == QEvent::Leave){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton.png"));
            }else if(event->type() == QEvent::MouseButtonPress){
                ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton-hover.png"));
            }else if(event->type() == QEvent::MouseButtonRelease){
                QMouseEvent *me = (QMouseEvent *)event;
                QLabel *lb = (QLabel *)obj;
                if(me->x() > 0 && me->x() < lb->width() && me->y() > 0 && me->y() < lb->height()){
                    this->close();
                    emit closePersonalchatdlg(bareJid);
                }else{
                    ui->btn_close->setPixmap(QPixmap(":/pixmap/image/closeButton.png"));
                }
            } else {
                return QObject::eventFilter(obj, event);
            }
        }

    if(obj==ui->closeButton||obj==ui->sendMessageButton
                            ||obj==ui->sendfileButton
                            ||obj==ui->saveFileButton
                            ||obj==ui->refuseButton)
    {
        if(event->type() == QEvent::MouseButtonPress)
        {
            QMouseEvent *me = (QMouseEvent *)event;
            dragPos = me->globalPos() - frameGeometry().topLeft();
        }else if(event->type() == QEvent::MouseButtonRelease)
        {
            setWindowOpacity(1);
        }
    }
    return QObject::eventFilter(obj, event);


}
/** Redefined to initialize favorites from settings. */
int CustomizeThemeDialog::exec()
{
	// Change the label that talks about star delegates
	SettingsPrivate *settings = SettingsPrivate::instance();
	bool starDelegateState = settings->isStarDelegates();
	labelLibraryDelegates->setEnabled(starDelegateState);
	radioButtonShowNeverScoredTracks->setEnabled(starDelegateState);
	radioButtonHideNeverScoredTracks->setEnabled(starDelegateState);

	if (settings->value("customizeThemeDialogGeometry").isNull()) {
		int w = qApp->desktop()->screenGeometry().width() / 2;
		int h = qApp->desktop()->screenGeometry().height() / 2;
		this->move(w - frameGeometry().width() / 2, h - frameGeometry().height() / 2);
	}
	return QDialog::exec();
}
예제 #27
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    this->model = new SailSizeModel(parent, 80);
    this->windSizeTableModel = new WindSizeTableModel(this, this->model);
    // connect the weightslider to the model
    QObject::connect(ui->weightSlider,SIGNAL(valueChanged(int)), this->model, SLOT(setWeight(int)));

    // connect the fromWindSlider to the model
    QObject::connect(ui->windSlider1,SIGNAL(valueChanged(int)),
                     this, SLOT(setWindSpeed(int)));

    // connect the fromWindSlider to the model
    QObject::connect(ui->windSlider2,SIGNAL(valueChanged(int)),
                     this, SLOT(setWindSpeed(int)));

    // connect the model update signal to the main window
    QObject::connect(this->model,SIGNAL(updated()), this, SLOT(modelUpdated()));

    ui->weightSlider->setValue(this->model->weight());

    ui->weightLabel->setMinimumWidth(90);
    ui->windRangeLabel->setMinimumWidth(90);

    this->updateWeightLabel();
    this->updateWindRangeLabel();

    ui->sailSizeTable->setModel(this->windSizeTableModel);
    ui->sailSizeTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
    // center window on screen
    QRect frect = frameGeometry();
    frect.moveCenter(QDesktopWidget().availableGeometry().center());
    move(frect.topLeft());
}
TilesOrderDialog::TilesOrderDialog(QWidget* pParent, const std::vector<unsigned int>& state)
	: QDialog(pParent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
{
	setupUi(this);

	QString boardStateStr;
	for (auto index : state)
	{
		boardStateStr += QString::number(index) + " ";
	}

	QRegExpValidator * validator = new QRegExpValidator();
	validator->setRegExp(QRegExp(validatorRegExpPattern(state.size())));

	lineEditPosition->setValidator(validator);
	lineEditPosition->setText(boardStateStr);

	connect(buttonCancel, &QPushButton::clicked, this, &TilesOrderDialog::reject);
	connect(buttonOk    , &QPushButton::clicked, this, &TilesOrderDialog::onOkClick);
	
	if (pParent)
	{
		move(pParent->frameGeometry().center() - frameGeometry().center());
	}
}
예제 #29
0
void Widget::mousePressEvent(QMouseEvent *e)
{
    if (!Settings::getInstance().getUseNativeDecoration())
    {
        if (e->button() == Qt::LeftButton)
        {
            if (inResizeZone)
            {
                allowToResize = true;

                if (e->pos().y() <= PIXELS_TO_ACT)
                {
                    if (e->pos().x() <= PIXELS_TO_ACT)
                        resizeDiagSupEsq = true;
                    else if (e->pos().x() >= geometry().width() - PIXELS_TO_ACT)
                        resizeDiagSupDer = true;
                    else
                        resizeVerSup = true;
                }
                else if (e->pos().x() <= PIXELS_TO_ACT)
                    resizeHorEsq = true;
            }
            else if (e->pos().x() >= PIXELS_TO_ACT and e->pos().x() < ui->titleBar->geometry().width()
                     and e->pos().y() >= PIXELS_TO_ACT and e->pos().y() < ui->titleBar->geometry().height())
            {
                moveWidget = true;
                dragPosition = e->globalPos() - frameGeometry().topLeft();
            }
        }

        e->accept();
    }
}
예제 #30
0
파일: shapedclock.cpp 프로젝트: RSATom/Qt
//! [1]
void ShapedClock::mousePressEvent(QMouseEvent *event)
{
    if (event->button() == Qt::LeftButton) {
        dragPosition = event->globalPos() - frameGeometry().topLeft();
        event->accept();
    }
}