示例#1
0
void GroupInviteForm::onGroupInviteRejected()
{
    QPushButton* rejectButton = static_cast<QPushButton*>(sender());
    QWidget* groupWidget = rejectButton->parentWidget();
    int index = scroll->widget()->layout()->indexOf(groupWidget);
    groupInvites.removeAt(index);

    deleteInviteButtons(groupWidget);
}
示例#2
0
void AddFriendForm::onFriendRequestRejected()
{
    QPushButton* rejectButton = static_cast<QPushButton*>(sender());
    QWidget* friendWidget = rejectButton->parentWidget();
    int index = requestsLayout->indexOf(friendWidget);
    removeFriendRequestWidget(friendWidget);
    Settings::getInstance().removeFriendRequest(requestsLayout->count() - index - 1);
    Settings::getInstance().savePersonal();
}
示例#3
0
void AddFriendForm::onFriendRequestAccepted()
{
    QPushButton* acceptButton = static_cast<QPushButton*>(sender());
    QWidget* friendWidget = acceptButton->parentWidget();
    int index = requestsLayout->indexOf(friendWidget);
    removeFriendRequestWidget(friendWidget);
    Settings::Request request = Settings::getInstance().getFriendRequest(requestsLayout->count() - index - 1);
    emit friendRequestAccepted(request.address);
    Settings::getInstance().removeFriendRequest(requestsLayout->count() - index - 1);
    Settings::getInstance().savePersonal();
}
void MultiViewWidget::createView()
{
  QPushButton *button = qobject_cast<QPushButton *>(sender());
  if (m_factory && button && button->parentWidget()
      && button->parentWidget()->parentWidget()) {
    QWidget *optionsWidget = button->parentWidget();
    ContainerWidget *container
        = qobject_cast<ContainerWidget *>(optionsWidget->parentWidget());
    if (container) {
      QWidget *widget = m_factory->createView(button->text());
      if (widget) {
        widget->installEventFilter(m_activeFilter);
        container->layout()->removeWidget(optionsWidget);
        container->layout()->addWidget(widget);
        optionsWidget->deleteLater();
        setActiveWidget(widget);
      }
    }
  }
}
示例#5
0
void GroupInviteForm::onGroupInviteAccepted()
{
    QPushButton* acceptButton = static_cast<QPushButton*>(sender());
    QWidget* groupWidget = acceptButton->parentWidget();
    int index = scroll->widget()->layout()->indexOf(groupWidget);
    GroupInvite invite = groupInvites.at(index);
    groupInvites.removeAt(index);

    deleteInviteButtons(groupWidget);

    emit groupInviteAccepted(invite.friendId, invite.type, invite.invite);
}
示例#6
0
void TilesetItemBox::editSelectedTileset()
{
    TilesetConfigureDialog *tilesetConfDia;

    if(mw()->activeChildWindow() == 1)
        tilesetConfDia = new TilesetConfigureDialog(&mw()->configs, mw()->activeLvlEditWin()->scene, mw());
    else if(mw()->activeChildWindow() == 3)
        tilesetConfDia = new TilesetConfigureDialog(&mw()->configs, mw()->activeWldEditWin()->scene, mw());
    else
        tilesetConfDia = new TilesetConfigureDialog(&mw()->configs, NULL, mw());

    util::DialogToCenter(tilesetConfDia);

    QPushButton *b = qobject_cast<QPushButton *>(sender());
    if(!b)
    {
        delete tilesetConfDia;
        return;
    }

    QWidget *parent = b->parentWidget();
    if(!parent)
    {
        delete tilesetConfDia;
        return;
    }

    QGroupBox *box = qobject_cast<QGroupBox *>(parent);
    if(!box)
    {
        delete tilesetConfDia;
        return;
    }

    QString fileName = b->property("tileset-file-name").toString();//box->title();
    QVector<SimpleTileset> ctilesets = loadCustomTilesets();
    for(int i = 0; i < ctilesets.size(); ++i)
    {
        SimpleTileset &aTileset = ctilesets[i];
        if(aTileset.fileName == fileName)
        {
            tilesetConfDia->loadSimpleTileset(aTileset, aTileset.customDir);
            tilesetConfDia->exec();
            break;
        }
    }

    delete tilesetConfDia;

    mw()->configs.loadTilesets();
    setTileSetBox();
}
示例#7
0
void TaskView::keyPressEvent(QKeyEvent* ke)
{
    if (ActiveCtrl && ActiveDialog) {
        if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) {
            // get all buttons of the complete task dialog
            QList<QPushButton*> list = this->findChildren<QPushButton*>();
            for (int i=0; i<list.size(); ++i) {
                QPushButton *pb = list.at(i);
                if (pb->isDefault() && pb->isVisible()) {
                    if (pb->isEnabled()) {
#if defined(FC_OS_MACOSX)
                        // #0001354: Crash on using Enter-Key for confirmation of chamfer or fillet entries
                        QPoint pos = QCursor::pos();
                        QCursor::setPos(pb->parentWidget()->mapToGlobal(pb->pos()));
#endif
                        pb->click();
#if defined(FC_OS_MACOSX)
                        QCursor::setPos(pos);
#endif
                    }
                    return;
                }
            }
        }
        else if (ke->key() == Qt::Key_Escape) {
            // get only the buttons of the button box
            QDialogButtonBox* box = ActiveCtrl->standardButtons();
            QList<QAbstractButton*> list = box->buttons();
            for (int i=0; i<list.size(); ++i) {
                QAbstractButton *pb = list.at(i);
                if (box->buttonRole(pb) == QDialogButtonBox::RejectRole) {
                    if (pb->isEnabled()) {
#if defined(FC_OS_MACOSX)
                        // #0001354: Crash on using Enter-Key for confirmation of chamfer or fillet entries
                        QPoint pos = QCursor::pos();
                        QCursor::setPos(pb->parentWidget()->mapToGlobal(pb->pos()));
#endif
                        pb->click();
#if defined(FC_OS_MACOSX)
                        QCursor::setPos(pos);
#endif
                    }
                    return;
                }
            }
        }
    }
    else {
        QScrollArea::keyPressEvent(ke);
    }
}
void LDViewExportOption::doResetGroup()
{
	QPushButton *pb = qobject_cast<QPushButton *>(sender());
	resetSettings(m_groups[pb->parentWidget()->layout()]);
}
示例#9
0
文件: mainwindow.cpp 项目: Nos-/htw
/**
 * @brief MainWindow::deletePersonButton reagiert, wenn der Button zum Löschen einer Person gedrückt wurde
 */
void MainWindow::deletePersonButton(){
    QPushButton *myB = qobject_cast<QPushButton*>(sender());
    /// und löscht die Person
    deletePerson(myB->parentWidget()->objectName().toInt());
}
示例#10
0
文件: mainwindow.cpp 项目: Nos-/htw
/**
 * @brief MainWindow::deleteMediumButton reagiert, wenn der Button zum Löschen eines Mediums gedrückt wurde
 */
void MainWindow::deleteMediumButton(){
    QPushButton *myB = qobject_cast<QPushButton*>(sender());
    /// und löscht das Medium
    deleteMedium(myB->parentWidget()->objectName().toInt());
}