示例#1
0
void TitleBar::OnSaveGeometry(const RectF &old_geometry, const RectF &new_geometry) {
  SetBounds(0.f, 0.f, new_geometry.width(), new_geometry.height());

  int y = ((int) new_geometry.height() - close_button_->GetHeight()) / 2;
  int x = y;
  close_button_->MoveTo(x, y);

//  new_x += close_button_->GetWidth() + kButtonSpace;
//  maximize_button_->MoveTo(new_x, new_y);
//
//  new_x += maximize_button_->GetWidth() + kButtonSpace;
//  minimize_button_->MoveTo(new_x, new_y);

  x = (int) new_geometry.width() - y - fullscreen_button_->GetWidth();
  fullscreen_button_->MoveTo(x, y);

  x -= maximize_button_->GetWidth() + kButtonSpace;
  maximize_button_->MoveTo(x, y);

  x -= minimize_button_->GetWidth() + kButtonSpace;
  minimize_button_->MoveTo(x, y);
}
示例#2
0
void Spinner::OnSaveGeometry(const RectF &old_rect, const RectF &new_rect) {
  SetBounds(0.f, 0.f, new_rect.width(), new_rect.height());
  Update();
}
示例#3
0
void TitleBar::OnConfigureGeometry(const RectF &old_geometry, const RectF &new_geometry) {
  RequestSaveGeometry(new_geometry);
  SetBounds(0.f, 0.f, new_geometry.width(), new_geometry.height());
}
示例#4
0
// 範囲選択終了
void GridLabel::mouseReleaseEvent(QMouseEvent *ev)
{
    if (!m_pEditData || !m_bCatchable)
    {
        return;
    }
    if (!bCatching)
    {
        return;
    }

    bCatching = false;
    if (m_bRectMove)
    { // 範囲移動中
        m_bRectMove = false;
        return;
    }
    m_bRectMove = false;

    EditData::ImageData *p = m_pEditData->getImageDataFromNo(m_Index);
    if (!p)
    {
        return;
    }

    int img_w = p->Image.width();
    int img_h = p->Image.height();

    RectF r = m_pEditData->getCatchRect();

    float x = ev->pos().x() / mScale;
    float y = ev->pos().y() / mScale;

    if (x < 0)
    {
        x = 0;
    }
    if (x > img_w)
    {
        x = img_w;
    }
    if (x < r.left())
    {
        x = r.left();
    }
    if (y < 0)
    {
        y = 0;
    }
    if (y > img_h)
    {
        y = img_h;
    }
    if (y < r.top())
    {
        y = r.top();
    }

    r.setRight(x);
    r.setBottom(y);
    if (r.width() <= 1 || r.height() <= 1)
    {
        r.setLeft(-2);
        r.setRight(-2);
        r.setTop(-1);
        r.setBottom(-1);
    }
    m_pEditData->setCatchRect(r);
    emit sig_changeCatchRect(r);

    repaint();
}