Пример #1
0
QRect QAccessibleMdiSubWindow::rect() const
{
    if (mdiSubWindow()->isHidden())
        return QRect();
    if (!mdiSubWindow()->parent())
        return QAccessibleWidget::rect();
    const QPoint pos = mdiSubWindow()->mapToGlobal(QPoint(0, 0));
    return QRect(pos, mdiSubWindow()->size());
}
Пример #2
0
void QAccessibleMdiSubWindow::setText(QAccessible::Text textType, const QString &text)
{
    if (textType == QAccessible::Name)
        mdiSubWindow()->setWindowTitle(text);
    else
        QAccessibleWidget::setText(textType, text);
}
Пример #3
0
QAccessibleInterface *QAccessibleMdiSubWindow::child(int index) const
{
    QMdiSubWindow *source = mdiSubWindow();
    if (index != 0 || !source->widget())
        return 0;

    return QAccessible::queryAccessibleInterface(source->widget());
}
Пример #4
0
QString QAccessibleMdiSubWindow::text(QAccessible::Text textType) const
{
    if (textType == QAccessible::Name) {
        QString title = mdiSubWindow()->windowTitle();
        title.replace(QLatin1String("[*]"), QLatin1String(""));
        return title;
    }
    return QAccessibleWidget::text(textType);
}
Пример #5
0
/**
 * Process state change events such as activation, minimizing or maximizing.
 */
bool DockedWindow::event(QEvent *e) {
  // std::cerr << "Docked event " << e->type() << '\n';
  if (e->type() == QEvent::NonClientAreaMouseButtonPress) {
    // User clicked the window title bar
    m_draggingToTiledWindow = true;
  } else if (e->type() == QEvent::NonClientAreaMouseMove) {
    // For some reason this event is fired when the user releases the mouse over
    // the title bar
    if (m_draggingToTiledWindow) {
      d_app->dropInTiledWindow(mdiSubWindow(), pos() - d_app->pos());
      return true;
    }
    m_draggingToTiledWindow = false;
    m_isInsideTiledWindow = false;
  }
  return QMdiSubWindow::event(e);
}
Пример #6
0
void DockedWindow::dragMouseMove(QPoint pos) {
  if (m_dragMouseDown) {
    if ((pos - m_dragStartPos).manhattanLength() <
        QApplication::startDragDistance()) {
      return;
    }

    QDrag *drag = new QDrag(d_app);
    QMimeData *mimeData = new QMimeData;

    MdiSubWindow *ptr = mdiSubWindow();
    auto d = QByteArray::fromRawData((const char *)ptr, 1);
    mimeData->setData("TiledWindow", d);

    drag->setMimeData(mimeData);
    Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction);
    (void)dropAction;
  }
}
Пример #7
0
QAccessible::State QAccessibleMdiSubWindow::state() const
{
    QAccessible::State state;
    state.focusable = true;
    if (!mdiSubWindow()->isMaximized()) {
        state.movable = true;
        state.sizeable = true;
    }
    if (mdiSubWindow()->isAncestorOf(QApplication::focusWidget())
            || QApplication::focusWidget() == mdiSubWindow())
        state.focused = true;
    if (!mdiSubWindow()->isVisible())
        state.invisible = true;
    if (!mdiSubWindow()->parentWidget()->contentsRect().contains(mdiSubWindow()->geometry()))
        state.offscreen = true;
    if (!mdiSubWindow()->isEnabled())
        state.disabled = true;
    return state;
}
Пример #8
0
int QAccessibleMdiSubWindow::indexOfChild(const QAccessibleInterface *child) const
{
    if (child && child->object() && child->object() == mdiSubWindow()->widget())
        return 0;
    return -1;
}
Пример #9
0
int QAccessibleMdiSubWindow::childCount() const
{
    if (mdiSubWindow()->widget())
        return 1;
    return 0;
}
Пример #10
0
/**
 * Process state change events such as activation, minimizing or maximizing.
 */
bool FloatingWindow::event(QEvent *e) {
  if (e->type() == QEvent::WindowActivate) {
    // If FloatingWindow was activated by clicking on it we need to
    // let the application know about it
    MdiSubWindow *w = dynamic_cast<MdiSubWindow *>(widget());
    if (w && this != d_app->getActiveFloating()) {
      // the second argument says that FloatingWindow must not be activated
      // again
      d_app->activateWindow(w, false);
    }
  } else if (e->type() == QEvent::WindowStateChange) {
    if (this->isMinimized()) {
#ifdef Q_OS_WIN
      // set parent to NULL which makes it minimize nicely into a program bar
      // icon
      this->setParent(NULL);
      this->showMinimized();
#endif
      mdiSubWindow()->setStatus(MdiSubWindow::Minimized);
      d_app->activateNewWindow();
    } else if (!this->isMaximized() || !this->isMinimized()) {
#ifdef Q_OS_WIN
      // re-parent to the main window making the floating window stay on top of
      // it
      if (this->parent() != d_app) {
        this->setParent(d_app);
        this->setWindowFlags(m_flags);
        this->showNormal();
      }
#endif
      mdiSubWindow()->setStatus(MdiSubWindow::Normal);
    } else if (this->isMaximized()) {
#ifdef Q_OS_WIN
      // re-parent to the main window making the floating window stay on top of
      // it
      if (this->parent() != d_app) {
        this->setParent(d_app);
        this->setWindowFlags(m_flags);
        this->showMaximized();
      }
#endif
      mdiSubWindow()->setStatus(MdiSubWindow::Maximized);
    }
  } else if (e->type() == QEvent::Close) {
    if (widget() && widget()->close()) {
      // forget about me and close
      d_app->removeFloatingWindow(this);
    } else {
      // don't close
      e->ignore();
      return true;
    }
  } else if (e->type() == QEvent::NonClientAreaMouseButtonPress) {
    // User clicked the window title bar
    m_draggingToTiledWindow = true;
    auto mu = static_cast<QMouseEvent *>(e);
    m_dragStartPos = mu->pos();
  } else if (e->type() == QEvent::NonClientAreaMouseMove) {
    // For some reason this event is fired when the user releases the mouse over
    // the title bar
    if (m_draggingToTiledWindow && m_isInsideTiledWindow) {
      m_draggingToTiledWindow = false;
      m_isInsideTiledWindow = false;
      d_app->dropInTiledWindow(mdiSubWindow(), pos() + m_dragStartPos);
      return true;
    }
    m_draggingToTiledWindow = false;
    m_isInsideTiledWindow = false;
  }
  return QMainWindow::event(e);
}