QWidget *PlayerCardDialog::createEquipArea(){ QGroupBox *area = new QGroupBox(tr("Equip area")); QVBoxLayout *layout = new QVBoxLayout(); const Weapon *weapon = player->getWeapon(); if(weapon){ QCommandLinkButton *button = new QCommandLinkButton(weapon->getFullName()); button->setIcon(weapon->getSuitIcon()); mapper->setMapping(button, weapon->getId()); connect(button, SIGNAL(clicked()), mapper, SLOT(map())); layout->addWidget(button); } const Armor *armor = player->getArmor(); if(armor){ QCommandLinkButton *button = new QCommandLinkButton(armor->getFullName()); button->setIcon(armor->getSuitIcon()); mapper->setMapping(button, armor->getId()); connect(button, SIGNAL(clicked()), mapper, SLOT(map())); layout->addWidget(button); } const Horse *horse = player->getDefensiveHorse(); if(horse){ QCommandLinkButton *button = new QCommandLinkButton(horse->getFullName() + tr("(+1 horse)")); button->setIcon(horse->getSuitIcon()); mapper->setMapping(button, horse->getId()); connect(button, SIGNAL(clicked()), mapper, SLOT(map())); layout->addWidget(button); } horse = player->getOffensiveHorse(); if(horse){ QCommandLinkButton *button = new QCommandLinkButton(horse->getFullName() + tr("(-1 horse)")); button->setIcon(horse->getSuitIcon()); mapper->setMapping(button, horse->getId()); connect(button, SIGNAL(clicked()), mapper, SLOT(map())); layout->addWidget(button); } if(layout->count() == 0){ QCommandLinkButton *no_equip = new QCommandLinkButton(tr("No equip")); no_equip->setEnabled(false); return no_equip; }else{ area->setLayout(layout); return area; } }
void MainWindow::createMenus(int parentMenu) { if ( ui->scrollAreaWidgetContents->layout() != NULL ) // очистка кнопок { QLayoutItem* item; while ((item = ui->scrollAreaWidgetContents->layout()->takeAt(0) ) != NULL ) { delete item->widget(); delete item; } delete ui->scrollAreaWidgetContents->layout(); } if (! dal_main->checkConnection()) { QMessageBox::warning(this, tr("Ошибка соединения"), tr("Соединение не установлено")); return; } QSqlQuery *query = new QSqlQuery("SELECT * FROM is_menus WHERE menu_parent = " + QString::number(parentMenu), dal_main->db); query->exec(); query->first(); // qDebug()<<query->lastError()<<query->size(); ui->groupBox->setVisible(true); ui->scrollArea->setMinimumSize(900, 400); // ui->scrollArea->setMaximumSize(800, 500); // ui->groupBox_menu->setMinimumSize(800, 1000); QGridLayout *menuLayout = new QGridLayout(ui->scrollAreaWidgetContents); ui->scrollAreaWidgetContents->setLayout(menuLayout); int row = 0; int column = 0; // QList<QCommandLinkButton*> list; // QSequentialAnimationGroup *anim = new QSequentialAnimationGroup; for (int i = 0; i < query->size(); ++i) { QCommandLinkButton* mbtn = new QCommandLinkButton(query->value(1).toString()); // QPushButton* mbtn = new QPushButton(query->value(1).toString()); mbtn->setText(query->value(1).toString()); mbtn->setMinimumSize(265,70); mbtn->setMaximumSize(265,70); mbtn->setIcon(QIcon(":/img/img/" + query->value(2).toString())); mbtn->setIconSize(QSize(30,60)); mbtn->setToolTip(query->value(5).toString()); QGraphicsDropShadowEffect * ef = new QGraphicsDropShadowEffect; // эффект тени ef->setBlurRadius(20); mbtn->setGraphicsEffect(ef); connect(mbtn,SIGNAL(clicked()),SLOT(menuClick())); // QGraphicsOpacityEffect* fade_effect = new QGraphicsOpacityEffect(mbtn); // mbtn->setGraphicsEffect(fade_effect); // QPropertyAnimation *animation = new QPropertyAnimation(fade_effect, "opacity"); // animation->setEasingCurve(QEasingCurve::InOutQuad); // animation->setDuration(100); // animation->setStartValue(0.01); // animation->setEndValue(1.0); // anim->addAnimation(animation); menuLayout->addWidget(mbtn,row,column); if(column<2) column++; else { column = 0; row++; } query->next(); } // anim->start(); // *555-050-* // *909-0-* ui->frame->setVisible(false); }
void CLogisticMainWindow::setupDockWindow(const bool &visible) { if (!visible) return; QDockWidget *dockDictionary = new QDockWidget(tr("Справочники")); dockDictionary->setFeatures(QDockWidget::NoDockWidgetFeatures); QFrame *frameDictionary = new QFrame(this); QCommandLinkButton *client = new QCommandLinkButton(tr("Заказчики"), tr("Справочник клиентов"), frameDictionary); client->setIcon(QIcon("data/picture/sidebar/customer.ico")); connect(client, SIGNAL(clicked()), this, SLOT(slotCustomerDictionary())); QCommandLinkButton *supplier = new QCommandLinkButton(tr("Поставщики"), tr("Справочник поставщиков"), frameDictionary); supplier->setIcon(QIcon("data/picture/sidebar/suppliers.ico")); connect(supplier, SIGNAL(clicked()), this, SLOT(slotSuppliersDictionary())); QCommandLinkButton *producer = new QCommandLinkButton(tr("Производители"), tr("Справочник производителей"), frameDictionary); producer->setIcon(QIcon("data/picture/sidebar/producers.ico")); connect(producer, SIGNAL(clicked()), this, SLOT(slotProdusersDictionary())); QCommandLinkButton *contact = new QCommandLinkButton(tr("Контакты"), tr("Справочник контактов"), frameDictionary); contact->setIcon(QIcon("data/picture/sidebar/contacts.ico")); connect(contact, SIGNAL(clicked()), this, SLOT(slotContactsDictionary())); QCommandLinkButton *position = new QCommandLinkButton (tr("Должности"), tr("Справочник должностей"), frameDictionary); position->setIcon(QIcon("data/picture/sidebar/positions.ico")); connect(position, SIGNAL(clicked()), this, SLOT(slotPositionsDictionary())); QCommandLinkButton *tasktype = new QCommandLinkButton (tr("Типы задач"), tr("Справочник типов задач"), frameDictionary); tasktype->setIcon(QIcon("data/picture/sidebar/tasktype.ico")); connect(tasktype, SIGNAL(clicked()), this, SLOT(slotTaskTypesDictionary())); QCommandLinkButton *contractor = new QCommandLinkButton(tr("Контрагенты"), tr("Справочник контрагентов"), frameDictionary); contractor->setIcon(QIcon("data/picture/sidebar/contractortype.ico")); connect(contractor, SIGNAL(clicked()), this, SLOT(slotContractorTypesDictionary())); QCommandLinkButton *status = new QCommandLinkButton (tr("Статусы"), tr("Справочник статусов"), frameDictionary); status->setIcon(QIcon("data/picture/sidebar/status.ico")); connect(status, SIGNAL(clicked()), this, SLOT(slotStatusDictionary())); QCommandLinkButton *priority = new QCommandLinkButton (tr("Приоритеты"), tr("Справочник приоритетов"), frameDictionary); priority->setIcon(QIcon("data/picture/sidebar/priority.ico")); connect(priority, SIGNAL(clicked()), this, SLOT(slotPrioritiesDictionary())); QCommandLinkButton *countrycity = new QCommandLinkButton (tr("Страны и города"), tr("Справочник стран и городов"), frameDictionary); countrycity->setIcon(QIcon("data/picture/sidebar/countryandcity.ico")); connect(countrycity, SIGNAL(clicked()), this, SLOT(slotCountryCityDictionary())); QVBoxLayout *vboxDictionary = new QVBoxLayout(frameDictionary); vboxDictionary->setSizeConstraint(QVBoxLayout::SetMinAndMaxSize); vboxDictionary->addWidget(client); vboxDictionary->addWidget(supplier); vboxDictionary->addWidget(producer); vboxDictionary->addWidget(contact); vboxDictionary->addWidget(position); vboxDictionary->addWidget(tasktype); vboxDictionary->addWidget(contractor); vboxDictionary->addWidget(status); vboxDictionary->addWidget(priority); vboxDictionary->addWidget(countrycity); dockDictionary->setLayout(vboxDictionary); dockDictionary->setWidget(frameDictionary); QDockWidget *dockFolder = new QDockWidget(tr("Папки")); dockFolder->setFeatures(QDockWidget::NoDockWidgetFeatures); QFrame *frameFolder = new QFrame(this); QCommandLinkButton *relation = new QCommandLinkButton(tr("Взаимоотношения"), frameFolder); relation->setIcon(QIcon("data/picture/sidebar/relations.ico")); connect(relation, SIGNAL(clicked()), this, SLOT(slotRelationsFolder())); QCommandLinkButton *calendar = new QCommandLinkButton (tr("Календарь"), frameFolder); calendar->setIcon(QIcon("data/picture/sidebar/calendar.ico")); connect(calendar, SIGNAL(clicked()), this, SLOT(slotCalendarFolder())); QCommandLinkButton *reminder = new QCommandLinkButton (tr("Напоминания"), frameFolder); reminder->setIcon(QIcon("data/picture/sidebar/reminder.ico")); connect(reminder, SIGNAL(clicked()), this, SLOT(slotReminderFolder())); QVBoxLayout *vboxFolder = new QVBoxLayout(frameFolder); vboxFolder->setSizeConstraint(QVBoxLayout::SetMinAndMaxSize); vboxFolder->addWidget(relation); vboxFolder->addWidget(calendar); vboxFolder->addWidget(reminder); dockFolder->setLayout(vboxFolder); dockFolder->setWidget(frameFolder); QDockWidget *dockAdditionally = new QDockWidget(tr("Дополнительно")); dockAdditionally->setFeatures(QDockWidget::NoDockWidgetFeatures); QFrame *frameAdditionally = new QFrame(this); QCommandLinkButton *accounting = new QCommandLinkButton(tr("Учетные операции"), tr("Справочник УО"), frameAdditionally); accounting->setIcon(QIcon("data/picture/sidebar/accounting.png")); connect(accounting, SIGNAL(clicked()), this, SLOT(slotAccountingAdditionally())); QVBoxLayout *vboxAdditionally = new QVBoxLayout(frameAdditionally); vboxAdditionally->setSizeConstraint(QVBoxLayout::SetMinAndMaxSize); vboxAdditionally->addWidget(accounting); dockAdditionally->setLayout(vboxAdditionally); dockAdditionally->setWidget(frameAdditionally); addDockWidget(Qt::LeftDockWidgetArea, dockDictionary); addDockWidget(Qt::LeftDockWidgetArea, dockFolder); addDockWidget(Qt::LeftDockWidgetArea, dockAdditionally); tabifyDockWidget(dockDictionary, dockFolder); tabifyDockWidget(dockFolder, dockAdditionally); }