QToolButton* MenuToolWidget::newToolButton(const QPixmap& icon, QString strToolTip)
{
    QToolButton* toolButton = new QToolButton(this);
    toolButton->setAutoRaise(true);
    toolButton->setIconSize( QSize(55,55) );
    toolButton->setFixedSize(55, 55);
    toolButton->setIcon(icon);
    toolButton->setStyleSheet("background:transparent;");
   // toolButton->setMask(icon.createHeuristicMask());
    toolButton->setToolTip(strToolTip);
//    toolButton->setStyleSheet("QToolButton{min-height:20;border-style:solid;border-top-left-radius:2px;"
//                              "border-top-right-radius:2px;""border:2px groove gray;border-radius:10px;padding:2px 4px;"
//                              "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 rgb(226,236,241), "
//                              "stop: 0.2 rgb(233,242,247),stop: 0.7 rgb(176,208,225),"
//                              "stop: 0.8 rgb(176,208,225),"
//                              "stop: 1 rgb(192,216,232));}");

    return toolButton;
}
Exemplo n.º 2
0
QToolButton* QuickButtonDisplay::actionButton(const char* objName, const char* icon, QString value) {
    QToolButton* toolButton = new QToolButton();
    toolButton->setIconSize(QSize(32, 32));
    toolButton->setObjectName(objName);
    toolButton->setIcon(QIcon(icon));
    toolButton->setText(value);
    toolButton->setToolTip(value);
    toolButton->setCursor(Qt::PointingHandCursor);
    toolButton->setContextMenuPolicy(Qt::CustomContextMenu);

    toolButton->setStyleSheet("QToolButton {"
                              "background: #242024;"
                              "}");

    connect(toolButton, SIGNAL(clicked()),
            toolBar, SLOT(quickButtonAction()));

    return toolButton;
}
Exemplo n.º 3
0
void SideDockWidget::createMenu(Qt::DockWidgetArea /*area*/)
{
//    QMenu *moveMenu = new QMenu(tr("Move To"),this);
//    QAction *act = new QAction(tr("OutputBar"),this);
//    act->setData(area);
//    moveMenu->addAction(act);
//    connect(act,SIGNAL(triggered()),this,SLOT(moveAction()));

    m_menu = new QMenu(this);

    QToolButton *btn = new QToolButton(m_toolBar);
    btn->setPopupMode(QToolButton::InstantPopup);
    btn->setIcon(QIcon("icon:images/movemenu.png"));
    btn->setMenu(m_menu);
    btn->setText(tr("SideBar"));
    btn->setToolTip(tr("Show SideBar"));
    btn->setStyleSheet("QToolButton::menu-indicator {image: none;}");
    m_toolBar->insertWidget(m_closeAct,btn);
}
Exemplo n.º 4
0
QToolButton * FilterItemWidget::createDeleteButton()
{
    QToolButton * deleteBtn = new QToolButton;
    deleteBtn->setFixedSize(16,16);
    deleteBtn->setStyleSheet("QToolButton { "
                               "border: none; "
                               "padding: 0px; "
                               "background: url(:/icons/close) center center no-repeat;"
                               "}"
                               "QToolButton:hover {"
                               "background: url(:/icons/close_hover) center center no-repeat;"
                               "}"
                               "QToolButton:pressed {"
                               "background: url(:/icons/close_pressed) center center no-repeat;"
                               "}");
    deleteBtn->setToolButtonStyle(Qt::ToolButtonIconOnly);
    deleteBtn->setToolTip(tr("Remove criterion"));
    return deleteBtn;
}
Exemplo n.º 5
0
void GlobStore::addLocation()
{
    QAction* storeAction = new QAction(tr("&Store"), this);
    QToolButton *storeButton = new QToolButton;
    storeButton->setDefaultAction(storeAction);
    storeButton->setFixedSize(15, 25);
    storeAction->setIcon(QPixmap(filesave_xpm));
    connect(storeAction, SIGNAL(triggered()), storeSignalMapper, SLOT(map()));
    storeSignalMapper->setMapping(storeAction, widgetList.count());

    QAction* restoreAction = new QAction(tr("&Restore"), this);
    QToolButton *restoreButton = new QToolButton;
    restoreButton->setDefaultAction(restoreAction);
    restoreButton->setFixedSize(45, 25);
    restoreAction->setText(QString::number(widgetList.count() + 1));
    restoreButton->setStyleSheet("font: 18pt");
    restoreAction->setDisabled(true);
    restoreAction->setObjectName("-1");
    restoreAction->setProperty("index", widgetList.count() + 1);
    connect(restoreAction, SIGNAL(triggered()), this, SLOT(mapRestoreSignal()));

    QWidget* globWidget = new QWidget;
    QHBoxLayout* globLayout = new QHBoxLayout;
    globLayout->setSpacing(0);
    globLayout->setMargin(0);
    globLayout->addWidget(storeButton);
    globLayout->addWidget(restoreButton);
    globWidget->setLayout(globLayout);

    indivButtonLayout->itemAt(0)->layout()->itemAt(0)->layout()->addWidget(globWidget);

    if (widgetList.count()) {
        widgetList.last()->layout()->itemAt(1)->widget()->setEnabled(true);
    }
    widgetList.append(globWidget);
    modified = true;
}
Exemplo n.º 6
0
Card::Card(int ct, int cn) :
        type(ct), cardNumber(cn)
{
    switch (type) {
    case 0:
        cardType = KUPA;
        break;

    case 1:
        cardType = KARO;
        break;

    case 2:
        cardType = SINEK;
        break;

    case 3:
        cardType = MACA;
        break;

    default:
        qDebug() << "Wrong card type";
    }

    cardName = this->toString();
    cardImageName = "./graphics/" + cardName.toLower();
    cardImageName.append(".png");

    QToolButton *foo = new QToolButton;
    foo->setMinimumSize(QSize(50, 60));
    foo->setStyleSheet(QString("border-image: url(%1)").arg(this->cardImageName));

    this->buttonPtr = static_cast<void *>(foo);

    //buttonPtr = (void *) getButton();
}
SelectionView::SelectionView(Gui::Document* pcDocument, QWidget *parent)
  : DockWindow(pcDocument,parent)
{
    setWindowTitle( tr( "Property View" ) );

    QVBoxLayout* pLayout = new QVBoxLayout( this ); 
    pLayout->setSpacing( 0 );
    pLayout->setMargin ( 0 );

    QLineEdit* searchBox = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    searchBox->setPlaceholderText( tr( "Search" ) );
#endif
    searchBox->setToolTip( tr( "Searches object labels" ) );
    pLayout->addWidget( searchBox );
    QHBoxLayout* llayout = new QHBoxLayout(searchBox);
    QToolButton* clearButton = new QToolButton(searchBox);
    clearButton->setFixedSize(18, 21);
    clearButton->setCursor(Qt::ArrowCursor);
    clearButton->setStyleSheet(QString::fromAscii("QToolButton {margin-bottom:6px}"));
    clearButton->setIcon(BitmapFactory().pixmap(":/icons/edit-cleartext.svg"));
    clearButton->setToolTip( tr( "Clears the search field" ) );
    llayout->addWidget(clearButton,0,Qt::AlignRight);

    selectionView = new QListWidget(this);
    selectionView->setContextMenuPolicy(Qt::CustomContextMenu);
    pLayout->addWidget( selectionView );
    resize( 200, 200 );

    QObject::connect(clearButton, SIGNAL(clicked()), searchBox, SLOT(clear()));
    QObject::connect(searchBox, SIGNAL(textChanged(QString)), this, SLOT(search(QString)));
    QObject::connect(selectionView, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(select(QListWidgetItem*)));
    QObject::connect(selectionView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onItemContextMenu(QPoint)));
    
    Gui::Selection().Attach(this);
}
Exemplo n.º 8
0
StartupView::StartupView( QWidget * parent ) 
  : QWidget( parent )
{
  m_templateListModel = boost::shared_ptr<TemplateListModel>( new TemplateListModel() );

  setStyleSheet("openstudio--StartupView { background: #E6E6E6; }");
  
#ifdef Q_WS_MAC
  setWindowFlags(Qt::FramelessWindowHint);
#else
  setWindowFlags(Qt::CustomizeWindowHint);
#endif

  QWidget * recentProjectsView = new QWidget();
  recentProjectsView->setStyleSheet("QWidget { background: #F2F2F2; }");
  QVBoxLayout * recentProjectsLayout = new QVBoxLayout();
  recentProjectsLayout->setContentsMargins(10,10,10,10);
  QLabel * recentProjectsLabel = new QLabel("Recent Projects");
  recentProjectsLabel->setStyleSheet("QLabel { font: bold }");
  recentProjectsLayout->addWidget(recentProjectsLabel,0,Qt::AlignTop);
  recentProjectsView->setLayout(recentProjectsLayout);

  QToolButton * openButton = new QToolButton();
  openButton->setText("Open File");
  openButton->setStyleSheet("QToolButton { font: bold; }");
  openButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon openIcon(":/images/open_file.png");
  openButton->setIcon(openIcon);
  openButton->setIconSize(QSize(40,40));
  connect( openButton, SIGNAL(clicked()), this, SIGNAL(openClicked()) );

  QToolButton * importButton = new QToolButton();
  importButton->setText("Import Idf");
  importButton->setStyleSheet("QToolButton { font: bold; }");
  importButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon importIcon(":/images/import_file.png");
  importButton->setIcon(importIcon);
  importButton->setIconSize(QSize(40,40));
  connect( importButton, SIGNAL(clicked()), this, SIGNAL(importClicked()) );
/*  
  QToolButton * importSDDButton = new QToolButton();
  importSDDButton->setText("Import SDD");
  importSDDButton->setStyleSheet("QToolButton { font: bold; }");
  importSDDButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon importSDDIcon(":/images/import_file.png");
  importSDDButton->setIcon(importSDDIcon);
  importSDDButton->setIconSize(QSize(40,40));
  connect( importSDDButton, SIGNAL(clicked()), this, SIGNAL(importSDDClicked()) );
*/
  QWidget * projectChooserView = new QWidget();
  projectChooserView->setFixedWidth(238);
  projectChooserView->setStyleSheet("QWidget { background: #F2F2F2; }");
  QVBoxLayout * projectChooserLayout = new QVBoxLayout();
  projectChooserLayout->setContentsMargins(10,10,10,10);
  QLabel * projectChooserLabel = new QLabel("Create New From Template");
  projectChooserLabel->setStyleSheet("QLabel { font: bold }");
  projectChooserLayout->addWidget(projectChooserLabel,0,Qt::AlignTop);
  m_listView = new QListView();
  m_listView->setViewMode(QListView::IconMode);
  m_listView->setModel(m_templateListModel.get());
  m_listView->setFocusPolicy(Qt::NoFocus);
  m_listView->setFlow(QListView::LeftToRight);
  m_listView->setUniformItemSizes(true);
  m_listView->setSelectionMode(QAbstractItemView::SingleSelection);
  projectChooserLayout->addWidget(m_listView);
  projectChooserView->setLayout(projectChooserLayout);

  m_projectDetailView = new QWidget();
  m_projectDetailView->setStyleSheet("QWidget { background: #F2F2F2; }");
  QVBoxLayout * projectDetailLayout = new QVBoxLayout();
  projectDetailLayout->setContentsMargins(10,10,10,10);
  m_projectDetailView->setLayout(projectDetailLayout);

  QWidget * footerView = new QWidget();
  footerView->setObjectName("FooterView");
  footerView->setStyleSheet("QWidget#FooterView { background: #E6E6E6; }");
  footerView->setMaximumHeight(50);
  footerView->setMinimumHeight(50);

  QPushButton * cancelButton = new QPushButton();
  cancelButton->setObjectName("StandardGrayButton");
  cancelButton->setMinimumSize(QSize(99,28));
  #ifdef OPENSTUDIO_PLUGIN
    cancelButton->setText("Cancel");
    connect( cancelButton, SIGNAL(clicked()), this, SLOT(hide()) );
  #else
    #ifdef Q_OS_MAC
      cancelButton->setText("Quit");
    #else
      cancelButton->setText("Exit");
    #endif
    connect( cancelButton, SIGNAL(clicked()), OpenStudioApp::instance(), SLOT(quit()) );
  #endif
  cancelButton->setStyleSheet("QPushButton { font: bold; }");

  QPushButton * chooseButton = new QPushButton();
  chooseButton->setObjectName("StandardBlueButton");
  chooseButton->setText("Choose");
  chooseButton->setMinimumSize(QSize(99,28));
  connect( chooseButton, SIGNAL(clicked()), this, SLOT(newFromTemplateSlot()) );
  chooseButton->setStyleSheet("QPushButton { font: bold; }");

  QHBoxLayout * hFooterLayout = new QHBoxLayout();
  hFooterLayout->setSpacing(25);
  hFooterLayout->setContentsMargins(0,0,0,0);
  hFooterLayout->addStretch();
  hFooterLayout->addWidget(cancelButton);
  hFooterLayout->addWidget(chooseButton);
  footerView->setLayout(hFooterLayout);

  QHBoxLayout * hLayout = new QHBoxLayout();
  QVBoxLayout * vLayout = new QVBoxLayout();

  QVBoxLayout * vOpenLayout = new QVBoxLayout();
  vOpenLayout->addWidget(recentProjectsView);
  vOpenLayout->addWidget(openButton);
  vOpenLayout->addWidget(importButton);
  //vOpenLayout->addWidget(importSDDButton);

  hLayout->addLayout(vOpenLayout);
  hLayout->addWidget(projectChooserView);
  hLayout->addWidget(m_projectDetailView,1);

  vLayout->addSpacing(50);
  vLayout->addLayout(hLayout);
  vLayout->addWidget(footerView);

  setLayout(vLayout);

  connect(m_listView,SIGNAL(clicked( const QModelIndex &)),this,SLOT( showDetailsForItem( const QModelIndex & ) ));

  m_listView->setCurrentIndex(m_templateListModel->index(0,0));
  showDetailsForItem(m_templateListModel->index(0,0));
}
Exemplo n.º 9
0
mainWindow::mainWindow()
{
    this->resize(440, 280);
    setWindowFlags(Qt::FramelessWindowHint);
    QLabel *background = new QLabel(this);
    background->setStyleSheet("background-color:lightblue");
    background->setGeometry(0,0,this->width(),this->height());

    int width = this->width();
    QToolButton *minButton = new QToolButton(this);
    QToolButton *closeButton = new QToolButton(this);

    connect(minButton,SIGNAL(clicked()),this,SLOT(showMinimized()));
    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));

    minButton->setGeometry(width-50,5,20,20);
    closeButton->setGeometry(width-25,5,20,20);

    QPixmap minPix = style()->standardPixmap(QStyle::SP_TitleBarMinButton);
    QPixmap closePix = style()->standardPixmap(QStyle::SP_TitleBarCloseButton);

    minButton->setIcon(minPix);
    closeButton->setIcon(closePix);
    minButton->setToolTip(tr("最小化"));
    closeButton->setToolTip(tr("关闭"));

    minButton->setStyleSheet("background-color:transparent");
    closeButton->setStyleSheet("background-color:transparent;");

    nickNameLabel.setParent(this);      //昵称处
    nickNameLabel.setGeometry(QRect(30, 10, 50, 25));
    nickNameLabel.setText("昵称");
    tipLabel.setParent(this);       //建议框
    tipLabel.setGeometry(QRect(100, 10, 220, 25));
    tipLabel.setText("您今天背诵了XX个单词");
    time.setParent(this);
    time.setGeometry(320, 10, 60, 25);
    QTimer *timer1 = new QTimer(this);
    timer1->start(1000);
    connect(timer1, SIGNAL(timeout()), this, SLOT(tim_slot()));
    inquireEdit.setParent(this);    //查询区
    inquireEdit.setGeometry(QRect(40, 60, 280, 30));
    inquireEdit.setText("请输入要查询的文本");
    inquireEdit.setFocus();
    search.setParent(this);         //搜索按钮
    search.setGeometry(QRect(330, 60, 100, 30));
    search.setText("开始查询");
    dayEnglish_1.setParent(this);   //每日英语
    dayEnglish_1.setGeometry(QRect(0, 100, 160, 220));
    dayEnglish_1.setWordWrap(true);
    dayEnglish_1.setAlignment(Qt::AlignTop);
    dayEnglish_1.setText("每\n日\n英\n语\n区");
    dayEnglish_1.setStyleSheet("background-color:lightgreen");
    wordEnglish_2.setParent(this);  //单词专区
    wordEnglish_2.setGeometry(QRect(160, 100,160, 220));
    wordEnglish_2.setWordWrap(true);
    wordEnglish_2.setAlignment(Qt::AlignTop);
    wordEnglish_2.setText("英\n语\n单\n词\n区");
    wordEnglish_2.setStyleSheet("background-color:lightyellow");
    testEnglish_3.setParent(this);  //测试专区
    testEnglish_3.setGeometry(QRect(320, 100, 160, 220));
    testEnglish_3.setWordWrap(true);
    testEnglish_3.setAlignment(Qt::AlignTop);
    testEnglish_3.setStyleSheet("background-color:purple");
    testEnglish_3.setText("英\n语\n测\n试\n区");
}
// adds dynamic actions to the toolbar (example settings)
void RenderWindow::slotPopulateToolbar(bool completeRefresh)
{
	WriteLog("cInterface::PopulateToolbar(QWidget *window, QToolBar *toolBar) started", 2);
	QDir toolbarDir = QDir(systemData.dataDirectory + "toolbar");
	toolbarDir.setSorting(QDir::Time);
	QStringList toolbarFiles = toolbarDir.entryList(QDir::NoDotAndDotDot | QDir::Files);
	QSignalMapper *mapPresetsFromExamplesLoad = new QSignalMapper(this);
	QSignalMapper *mapPresetsFromExamplesRemove = new QSignalMapper(this);
	ui->toolBar->setIconSize(
		QSize(gPar->Get<int>("toolbar_icon_size"), gPar->Get<int>("toolbar_icon_size")));

	QList<QAction *> actions = ui->toolBar->actions();
	QStringList toolbarInActions;
	for (int i = 0; i < actions.size(); i++)
	{
		QAction *action = actions.at(i);
		if (action->objectName() == "actionAdd_Settings_to_Toolbar") continue;
		if (!toolbarFiles.contains(action->objectName()) || completeRefresh)
		{
			// preset has been removed
			ui->toolBar->removeAction(action);
		}
		else
		{
			toolbarInActions << action->objectName();
		}
	}

	for (int i = 0; i < toolbarFiles.size(); i++)
	{
		if (toolbarInActions.contains(toolbarFiles.at(i)))
		{
			// already present
			continue;
		}
		QString filename = systemData.dataDirectory + "toolbar/" + toolbarFiles.at(i);
		cThumbnailWidget *thumbWidget = NULL;

		if (QFileInfo(filename).suffix() == QString("fract"))
		{
			WriteLogString("Generating thumbnail for preset", filename, 2);
			cSettings parSettings(cSettings::formatFullText);
			parSettings.BeQuiet(true);

			if (parSettings.LoadFromFile(filename))
			{
				cParameterContainer *par = new cParameterContainer;
				cFractalContainer *parFractal = new cFractalContainer;
				InitParams(par);
				for (int i = 0; i < NUMBER_OF_FRACTALS; i++)
					InitFractalParams(&parFractal->at(i));

				/****************** TEMPORARY CODE FOR MATERIALS *******************/

				InitMaterialParams(1, par);

				/*******************************************************************/

				if (parSettings.Decode(par, parFractal))
				{
					thumbWidget = new cThumbnailWidget(
						gPar->Get<int>("toolbar_icon_size"), gPar->Get<int>("toolbar_icon_size"), 2, this);
					thumbWidget->UseOneCPUCore(true);
					thumbWidget->AssignParameters(*par, *parFractal);
				}
				delete par;
				delete parFractal;
			}
		}

		if (thumbWidget)
		{
			QWidgetAction *action = new QWidgetAction(this);
			QToolButton *buttonLoad = new QToolButton;
			QVBoxLayout *tooltipLayout = new QVBoxLayout;
			QToolButton *buttonRemove = new QToolButton;

			tooltipLayout->setContentsMargins(3, 3, 3, 3);
			tooltipLayout->addWidget(thumbWidget);
			QIcon iconDelete = QIcon::fromTheme("list-remove", QIcon(":system/icons/list-remove.svg"));
			buttonRemove->setIcon(iconDelete);
			buttonRemove->setMaximumSize(QSize(15, 15));
			buttonRemove->setStyleSheet("margin-bottom: -2px; margin-left: -2px;");
			tooltipLayout->addWidget(buttonRemove);
			buttonLoad->setToolTip(QObject::tr("Toolbar settings: ") + filename);
			buttonLoad->setLayout(tooltipLayout);
			action->setDefaultWidget(buttonLoad);
			action->setObjectName(toolbarFiles.at(i));
			ui->toolBar->addAction(action);

			mapPresetsFromExamplesLoad->setMapping(buttonLoad, filename);
			mapPresetsFromExamplesRemove->setMapping(buttonRemove, filename);
			QApplication::connect(buttonLoad, SIGNAL(clicked()), mapPresetsFromExamplesLoad, SLOT(map()));
			QApplication::connect(
				buttonRemove, SIGNAL(clicked()), mapPresetsFromExamplesRemove, SLOT(map()));
		}
	}
	QApplication::connect(
		mapPresetsFromExamplesLoad, SIGNAL(mapped(QString)), this, SLOT(slotMenuLoadPreset(QString)));

	QApplication::connect(mapPresetsFromExamplesRemove, SIGNAL(mapped(QString)), this,
		SLOT(slotMenuRemovePreset(QString)));

	WriteLog("cInterface::PopulateToolbar(QWidget *window, QToolBar *toolBar) finished", 2);
}
Exemplo n.º 11
0
bossWindow::bossWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::bossWindow)
{
    ui->setupUi(this);
#pragma region window initialize
    QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity");
    animation->setDuration(700);
    animation->setStartValue(0);
    animation->setEndValue(1);
    animation->start();
    //界面动画,改变透明度的方式出现0 - 1渐变
    //设置窗体标题栏隐藏并设置位于顶层
    QPalette palette;
    setWindowOpacity(1);
    QPixmap pixmap("image/uiBG.png");
    palette.setBrush(ui->Under->backgroundRole(),QBrush(pixmap));
    ui->Under->setPalette(palette);
    ui->Under->setMask(pixmap.mask());  //可以将图片中透明部分显示为透明的
    ui->Under->setAutoFillBackground(true);

    ui->lineEdit_passwd->setEchoMode(QLineEdit::Password);

    setWindowFlags(Qt::FramelessWindowHint);
    setAttribute(Qt::WA_TranslucentBackground);
    //构建最小化、最大化、关闭按钮
    QToolButton *minButton = new QToolButton(this);
    QToolButton *closeButton= new QToolButton(this);
    connect (minButton,SIGNAL(clicked()),this,SLOT(showMinimized()));
    connect (closeButton,SIGNAL(clicked()),this,SLOT(wind_close()));//构建新槽 关闭当前窗口=注销
    //获取最小化、关闭按钮图标
    QPixmap minPix  = style()->standardPixmap(QStyle::SP_TitleBarMinButton);
    QPixmap closePix = style()->standardPixmap(QStyle::SP_TitleBarCloseButton);
    //设置最小化、关闭按钮图标
    minButton->setIcon(minPix);
    closeButton->setIcon(closePix);
    //设置最小化、关闭按钮在界面的位置
    minButton->setGeometry(700-30,10,20,20);
    closeButton->setGeometry(700-8,10,20,20);
    //设置鼠标移至按钮上的提示信息
    minButton->setToolTip(tr("最小化"));
    closeButton->setToolTip(tr("关闭"));
    //设置最小化、关闭按钮的样式
    minButton->setStyleSheet("background-color:transparent;");
    closeButton->setStyleSheet("background-color:transparent;");
    qDebug()<< "asdasd";
//    ui->frame_menu->hide();
    ui->frame_order->hide();//查看页面隐藏
    ui->frame_scy->hide();
    ui->label_username->setText(all_SCY[active_scy].show_username());//用户名设置
    ui->lcdNumber_amount->display(all_SCY[active_scy].show_amount_count());//总金额
    ui->lcdNumber_counter->display(all_SCY[active_scy].show_order_count());//总订单数

#pragma endregion window initialize

    int i;

    /*菜单初始化*/
    model_menu2->setHorizontalHeaderItem(0,new QStandardItem(QObject::tr("Name")));//行标设置
    model_menu2->setHorizontalHeaderItem(1,new QStandardItem(QObject::tr("Price")));
    model_menu2->setHorizontalHeaderItem(2,new QStandardItem(QObject::tr("Rank")));
    ui->tableView_menu->setSelectionBehavior(QAbstractItemView::SelectRows);//点击选中行
    ui->tableView_menu->setEditTriggers(QAbstractItemView::NoEditTriggers);//不能编辑
    /*输出菜单至界面*/
    for (i = 0;i<all_food.size();i++)
    {
        model_menu2->setItem(i, 0, new QStandardItem(all_food[i].show_food_name()));//输出菜品名字
        model_menu2->setItem(i, 1, new QStandardItem(QString::number(all_food[i].show_food_price(),10)));//价格
        model_menu2->setItem(i, 2, new QStandardItem("★★★★★"));//评分
    }
    ui->tableView_menu->setModel(model_menu2);//讲model与tableview关联

    ui->tableView_menu->setColumnWidth(0,184);//设置列宽
    ui->tableView_menu->setColumnWidth(1,86);
    ui->tableView_menu->setColumnWidth(2,86);


    model_orders->setHorizontalHeaderItem(0,new QStandardItem(QObject::tr("OrderID")));
    model_orders->setHorizontalHeaderItem(1,new QStandardItem(QObject::tr("Address")));
    model_orders->setHorizontalHeaderItem(2,new QStandardItem(QObject::tr("Amount")));
    model_orders->setHorizontalHeaderItem(3,new QStandardItem(QObject::tr("state")));
    model_orders->setHorizontalHeaderItem(4,new QStandardItem(QObject::tr("Customer")));
    model_orders->setHorizontalHeaderItem(5,new QStandardItem(QObject::tr("Deliver")));
    ui->tableView_orders ->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui->tableView_orders->setEditTriggers(QAbstractItemView::NoEditTriggers);
    ui->tableView_orders->setModel(model_orders);

    ui->tableView_orders->setColumnWidth(0,50);
    ui->tableView_orders->setColumnWidth(1,200);
    ui->tableView_orders->setColumnWidth(2,50);
    ui->tableView_orders->setColumnWidth(3,80);
    ui->tableView_orders->setColumnWidth(4,80);
    ui->tableView_orders->setColumnWidth(5,80);

    set_view_orders();

    model_scy->setHorizontalHeaderItem(0,new QStandardItem(QObject::tr("ID")));
    model_scy->setHorizontalHeaderItem(1,new QStandardItem(QObject::tr("Name")));
    model_scy->setHorizontalHeaderItem(2,new QStandardItem(QObject::tr("Delivering order")));
    model_scy->setHorizontalHeaderItem(3,new QStandardItem(QObject::tr("Amount count")));
    model_scy->setHorizontalHeaderItem(4,new QStandardItem(QObject::tr("Order count")));
    ui->tableView_scy ->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui->tableView_scy->setEditTriggers(QAbstractItemView::NoEditTriggers);
    ui->tableView_scy->setModel(model_scy);
    set_view_scy();
}
Exemplo n.º 12
0
ContractForm::ContractForm(QString id, QWidget *parent, bool onlyForRead) :
    QDialog(parent)
{
    indexTemp = id;
    QFile file(":/ToolButtonStyle.txt");
    file.open(QFile::ReadOnly);
    QString styleSheetString = QLatin1String(file.readAll());

    labelNumber = new QLabel(trUtf8("Number:"));
    editNumber = new LineEdit;
    editNumber->setReadOnly(onlyForRead);
    labelNumber->setBuddy(editNumber);

    labelDate = new QLabel(trUtf8("Date:"));
    editDate = new QDateEdit;
    editDate->setCalendarPopup(true);
    editDate->setReadOnly(onlyForRead);
    editDate->setDate(QDate::currentDate());

    labelEmployee = new QLabel(trUtf8("FIO:"));
    editEmployee = new LineEdit;
    editEmployee->setReadOnly(onlyForRead);
    labelEmployee->setBuddy(editEmployee);

    QSqlQueryModel *employeeModel = new QSqlQueryModel;
    employeeModel->setQuery("SELECT employeename FROM employee");
    QCompleter *employeeCompleter = new QCompleter(employeeModel);
    employeeCompleter->setCompletionMode(QCompleter::PopupCompletion);
    employeeCompleter->setCaseSensitivity(Qt::CaseSensitive);
    editEmployee->setCompleter(employeeCompleter);

    QToolButton *addButton = new QToolButton;
    QPixmap addPix(":/add.png");
    addButton->setIcon(addPix);
    addButton->setToolTip(trUtf8("Add new record"));
    connect(addButton,SIGNAL(clicked()),this,SLOT(addRecord()));
    addButton->setStyleSheet(styleSheetString);

    QToolButton *seeButton = new QToolButton;
    QPixmap seePix(":/see.png");
    seeButton->setIcon(seePix);
    seeButton->setToolTip(trUtf8("See select item"));
    connect(seeButton,SIGNAL(clicked()),this,SLOT(seeRecord()));
    seeButton->setStyleSheet(styleSheetString);

    QToolButton *listButton = new QToolButton;
    QPixmap listPix(":/list.png");
    listButton->setIcon(listPix);
    listButton->setToolTip(trUtf8("See list of item"));
    connect(listButton,SIGNAL(clicked()),this,SLOT(listRecord()));
    listButton->setStyleSheet(styleSheetString);

    QHBoxLayout *editLayout = new QHBoxLayout;
    editLayout->addWidget(labelEmployee);
    editLayout->addWidget(editEmployee);
    if(!onlyForRead){
        editLayout->addWidget(addButton);
        editLayout->addWidget(seeButton);
        editLayout->addWidget(listButton);
    }

    savePushButton = new QPushButton(trUtf8("Save"));
    connect(savePushButton,SIGNAL(clicked()),this,SLOT(editRecord()));
    savePushButton->setToolTip(trUtf8("Save And Close Button"));

    cancelPushButton = new QPushButton(trUtf8("Cancel"));
    cancelPushButton->setDefault(true);
    cancelPushButton->setStyleSheet("QPushButton:hover {color: red}");
    connect(cancelPushButton,SIGNAL(clicked()),this,SLOT(accept()));
    cancelPushButton->setToolTip(trUtf8("Cancel Button"));

    printPushButton = new QPushButton(trUtf8("Print"));
    //connect(savePushButton,SIGNAL(clicked()),this,SLOT(editRecord()));
    printPushButton->setToolTip(trUtf8("Print Contract Button"));

    buttonBox = new QDialogButtonBox;
    buttonBox->addButton(printPushButton,QDialogButtonBox::ActionRole);
    buttonBox->addButton(cancelPushButton,QDialogButtonBox::ActionRole);
    buttonBox->addButton(savePushButton,QDialogButtonBox::ActionRole);

    if(indexTemp != ""){
        QSqlQuery query;
        query.prepare("SELECT organizationname FROM organization WHERE organizationid = ?");
        query.addBindValue(indexTemp);
        query.exec();
        while(query.next()){
            //editOrganization->setText(query.value(0).toString());
        }
    }else{
        //editOrganization->clear();
    }

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->addWidget(labelNumber,0,0);
    mainLayout->addWidget(editNumber,0,1);
    mainLayout->addWidget(labelDate,0,2);
    mainLayout->addWidget(editDate,0,3);
    mainLayout->addLayout(editLayout,1,0,1,3);
    if(!onlyForRead){
        mainLayout->addWidget(buttonBox,2,3);
        //editOrganization->selectAll();
    }

    setLayout(mainLayout);

    setWindowTitle(trUtf8("Organization"));
}
Exemplo n.º 13
0
void SideBarCalendar::setUpViewMiniCalendar(){

    miniCal = new CustomCalendarWidget;
    QToolButton* next = new QToolButton;
    QToolButton* prev = new QToolButton;
    QPushButton* today = new QPushButton("Aujourd'hui");
    year = new QLabel(QString::number(miniCal->selectedDate().year()));
    month = new QLabel(QDate::longMonthName(miniCal->selectedDate().month()));

    QString styleToolButton = "QToolButton {background-color: rgba(0,0,0,0)}";
    QSize sizeToolButton(24,24);
    next->setIcon(QIcon(":/icons/img/icons/ic_chevron_right_48px.svg"));
    next->setStyleSheet(styleToolButton);
    next->setIconSize(sizeToolButton);
    next->setCursor(Qt::PointingHandCursor);

    prev->setIcon(QIcon(":/icons/img/icons/ic_chevron_left_48px.svg"));
    prev->setStyleSheet(styleToolButton);
    prev->setIconSize(sizeToolButton);
    prev->setCursor(Qt::PointingHandCursor);

    /* Infos jour sélectionné
     * Contient : No du jour et nom du jour de la semaine
     */
    currentDayCal = new DayWidget;
    currentDayCal->setDayName(QDate::longDayName(miniCal->selectedDate().dayOfWeek()));
    currentDayCal->setDayNumber(miniCal->selectedDate().day());

    /* Header
     * Contient: Bouton next, prev, mois et année
     */
    QWidget* header = new QWidget;
    header->setStyleSheet("QLabel{font-size: 16px;}");
    QHBoxLayout* headerLayout = new QHBoxLayout;
    headerLayout->addWidget(prev);
    headerLayout->addStretch(1);
    headerLayout->addWidget(month);
    headerLayout->addWidget(year);
    headerLayout->addStretch(1);
    headerLayout->addWidget(next);
    header->setLayout(headerLayout);

    /*
     * Layout principale
     * Contient: Header et Calendar
     */
    layoutMiniCalendar = new QVBoxLayout;

    layoutMiniCalendar->addWidget(currentDayCal);
    layoutMiniCalendar->addWidget(header);
    layoutMiniCalendar->addWidget(today, 0, Qt::AlignCenter);
    layoutMiniCalendar->addWidget(miniCal, 0, Qt::AlignHCenter);
    layoutMiniCalendar->addStretch(1);
    miniCal->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    miniCal->setFixedHeight(280);
    miniCal->setFixedWidth(280);

    connect(prev, SIGNAL(clicked()), miniCal, SLOT(showPreviousMonth()));
    connect(next, SIGNAL(clicked()), miniCal, SLOT(showNextMonth()));
    connect(miniCal, SIGNAL(currentPageChanged(int,int)), this, SLOT(pageChanged(int,int)));
    connect(miniCal, SIGNAL(selectionChanged()), this, SLOT(onDayClicked()));
    connect(today, SIGNAL(clicked()), this, SLOT(onTodayClicked()));

    viewMiniCalendar->setLayout(layoutMiniCalendar);
}
Exemplo n.º 14
0
void ToolDockWidget::createMenu(Qt::DockWidgetArea area, bool split)
{
    QMenu *moveMenu = new QMenu(tr("Move To"),this);
    if (area != Qt::TopDockWidgetArea) {
        QAction *act = new QAction(tr("Top"),this);
        act->setData(Qt::TopDockWidgetArea);
        moveMenu->addAction(act);
        connect(act,SIGNAL(triggered()),this,SLOT(moveAction()));
        QAction *act1 = new QAction(tr("Top : Split"),this);
        act1->setData(Qt::TopDockWidgetArea);
        moveMenu->addAction(act1);
        connect(act1,SIGNAL(triggered()),this,SLOT(moveActionSplit()));
    }
    if (area != Qt::BottomDockWidgetArea) {
        QAction *act = new QAction(tr("Bottom"),this);
        act->setData(Qt::BottomDockWidgetArea);
        moveMenu->addAction(act);
        connect(act,SIGNAL(triggered()),this,SLOT(moveAction()));
        QAction *act1 = new QAction(tr("Bottom : Split"),this);
        act1->setData(Qt::BottomDockWidgetArea);
        moveMenu->addAction(act1);
        connect(act1,SIGNAL(triggered()),this,SLOT(moveActionSplit()));
    }
    if (area != Qt::LeftDockWidgetArea) {
        QAction *act = new QAction(tr("Left"),this);
        act->setData(Qt::LeftDockWidgetArea);
        moveMenu->addAction(act);
        connect(act,SIGNAL(triggered()),this,SLOT(moveAction()));
        QAction *act1 = new QAction(tr("Left : Split"),this);
        act1->setData(Qt::LeftDockWidgetArea);
        moveMenu->addAction(act1);
        connect(act1,SIGNAL(triggered()),this,SLOT(moveActionSplit()));
    }
    if (area != Qt::RightDockWidgetArea) {
        QAction *act = new QAction(tr("Right"),this);
        act->setData(Qt::RightDockWidgetArea);
        moveMenu->addAction(act);
        connect(act,SIGNAL(triggered()),this,SLOT(moveAction()));
        QAction *act1 = new QAction(tr("Right : Split"),this);
        act1->setData(Qt::RightDockWidgetArea);
        moveMenu->addAction(act1);
        connect(act1,SIGNAL(triggered()),this,SLOT(moveActionSplit()));
    }

    QMenu *menu = new QMenu(this);
    if (split) {
        QAction *unsplitAct = new QAction(tr("UnSplit"),this);
        unsplitAct->setData(area);
        connect(unsplitAct,SIGNAL(triggered()),this,SLOT(unsplitAction()));
        menu->addAction(unsplitAct);
    } else {
        QAction *splitAct = new QAction(tr("Split"),this);
        splitAct->setData(area);
        connect(splitAct,SIGNAL(triggered()),this,SLOT(splitAction()));
        menu->addAction(splitAct);
    }
    menu->addAction(moveMenu->menuAction());

    QToolButton *btn = new QToolButton(m_toolBar);
    btn->setPopupMode(QToolButton::InstantPopup);
    btn->setIcon(QIcon("icon:images/movemenu.png"));
    btn->setMenu(menu);
    btn->setText(tr("Move To"));
    btn->setToolTip(tr("Move To"));
    btn->setStyleSheet("QToolButton::menu-indicator {image: none;}");
    m_toolBar->insertWidget(m_closeAct,btn);
}
Exemplo n.º 15
0
loginWindow::loginWindow()
{
    this->resize(480,240);
    setWindowFlags(Qt::FramelessWindowHint);
    QLabel *background = new QLabel(this);
    background->setStyleSheet("background-color:lightblue");
    background->setGeometry(0,0,this->width(),this->height());

    int width = this->width();
    QToolButton *minButton = new QToolButton(this);
    QToolButton *closeButton = new QToolButton(this);

    connect(minButton, SIGNAL(clicked()), this, SLOT(showMinimized()));
    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));

    minButton->setGeometry(width-50, 5, 20, 20);
    closeButton->setGeometry(width-25, 5, 20, 20);

    QPixmap minPix = style()->standardPixmap(QStyle::SP_TitleBarMinButton);
    QPixmap closePix = style()->standardPixmap(QStyle::SP_TitleBarCloseButton);

    minButton->setIcon(minPix);
    closeButton->setIcon(closePix);
    minButton->setToolTip("最小化");
    closeButton->setToolTip("关闭");

    minButton->setStyleSheet("background-color:transparent");
    closeButton->setStyleSheet("background-color:transparent");

    logininLabel.setParent(this);
    logininLabel.setGeometry(QRect(20, 30, 150, 60));
    logininLabel.setText("登陆界面");
    logininLabel.setStyleSheet("font-size:30px;color:black");

    wordLearning.setParent(this);
    wordLearning.setGeometry(QRect(280, 20, 180, 80));
    wordLearning.setText("单词攻克者");
    wordLearning.setStyleSheet("font-size:30px");

    join_us.setParent(this);
    join_us.setGeometry(QRect(280, 120, 200, 40));
    join_us.setText("  如果还没有加入我们\n请点击注册以获得更佳体验");

    usernameLabel.setParent(this);
    usernameLabel.setGeometry(QRect(50, 100, 50, 20));
    usernameLabel.setText("用户名");

    passwordLabel.setParent(this);
    passwordLabel.setGeometry(QRect(50, 130, 50, 20));
    passwordLabel.setText("密码");

    usernameEdit.setParent(this);
    usernameEdit.setGeometry(QRect(105, 100, 120, 20));
    usernameEdit.setMaxLength(20);
    usernameEdit.setFocus();
    passwordEdit.setParent(this);
    passwordEdit.setGeometry(QRect(105, 130, 120, 20));
    passwordEdit.setMaxLength(25);
    passwordEdit.setEchoMode(QLineEdit::Password);

    loginButton.setParent(this);
    regisButton.setParent(this);
    loginButton.setGeometry(QRect(100, 180, 100, 30));
    loginButton.setText("login");
    regisButton.setGeometry(QRect(305, 180, 100, 30));
    regisButton.setText("点我注册");

    passwordBox.setParent(this);
    passwordBox.setGeometry(145, 155, 15, 15);
    rememberPasswordLabel.setParent(this);
    rememberPasswordLabel.setGeometry(165, 155, 70, 15);
    rememberPasswordLabel.setText("记住密码");

}
Exemplo n.º 16
0
BtBibleKeyWidget::BtBibleKeyWidget(const CSwordBibleModuleInfo *mod,
                                   CSwordVerseKey *key, QWidget *parent,
                                   const char *name)
   : QWidget(parent), m_key(key), m_dropDownHoverTimer(this)
{
    Q_UNUSED(name);

    updatelock = false;
    m_module = mod;

    setFocusPolicy(Qt::WheelFocus);

    QToolButton* clearRef = new QToolButton(this);
    clearRef->setIcon(CResMgr::icon_clearEdit());
    clearRef->setAutoRaise(true);
    clearRef->setStyleSheet("QToolButton{margin:0px;}");
    connect(clearRef, SIGNAL(clicked()), SLOT(slotClearRef()) );

    m_bookScroller = new CScrollerWidgetSet(this);

    m_textbox = new BtLineEdit( this );
    setFocusProxy(m_textbox);
    m_textbox->setContentsMargins(0, 0, 0, 0);

    m_chapterScroller = new CScrollerWidgetSet(this);
    m_verseScroller = new CScrollerWidgetSet(this);

    QHBoxLayout* m_mainLayout = new QHBoxLayout( this );
    m_mainLayout->setContentsMargins(0, 0, 0, 0);
    m_mainLayout->setSpacing(0);
    m_mainLayout->addWidget(clearRef);
    m_mainLayout->addWidget(m_bookScroller);
    m_mainLayout->addWidget(m_textbox);
    m_mainLayout->addWidget(m_chapterScroller);
    m_mainLayout->addWidget(m_verseScroller);


    setTabOrder(m_textbox, 0);
    m_dropDownButtons = new QWidget(0);
    m_dropDownButtons->setWindowFlags(Qt::Popup);
    m_dropDownButtons->setAttribute(Qt::WA_WindowPropagation);
    m_dropDownButtons->setCursor(Qt::ArrowCursor);
    QHBoxLayout *dropDownButtonsLayout(new QHBoxLayout(m_dropDownButtons));
    m_bookDropdownButton = new BtBookDropdownChooserButton(this);
    dropDownButtonsLayout->addWidget(m_bookDropdownButton, 2);
    m_chapterDropdownButton = new BtChapterDropdownChooserButton(this);
    dropDownButtonsLayout->addWidget(m_chapterDropdownButton, 1);
    m_verseDropdownButton = new BtVerseDropdownChooserButton(this);
    dropDownButtonsLayout->addWidget(m_verseDropdownButton, 1);
    dropDownButtonsLayout->setContentsMargins(0, 0, 0, 0);
    dropDownButtonsLayout->setSpacing(0);
    m_dropDownButtons->setLayout(dropDownButtonsLayout);
    m_dropDownButtons->hide();

    m_dropDownButtons->installEventFilter(this);

    m_dropDownHoverTimer.setInterval(500);
    m_dropDownHoverTimer.setSingleShot(true);
    connect(&m_dropDownHoverTimer, SIGNAL(timeout()),
            m_dropDownButtons, SLOT(hide()));

    QString scrollButtonToolTip(tr("Scroll through the entries of the list. Press the button and move the mouse to increase or decrease the item."));
    m_bookScroller->setToolTips(
        tr("Next book"),
        scrollButtonToolTip,
        tr("Previous book")
    );
    m_chapterScroller->setToolTips(
        tr("Next chapter"),
        scrollButtonToolTip,
        tr("Previous chapter")
    );
    m_verseScroller->setToolTips(
        tr("Next verse"),
        scrollButtonToolTip,
        tr("Previous verse")
    );

    // signals and slots connections

    connect(m_bookScroller, SIGNAL(change(int)), SLOT(slotStepBook(int)));
    connect(m_bookScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock()));
    connect(m_bookScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock()));
    connect(m_textbox, SIGNAL(returnPressed()), SLOT(slotReturnPressed()));
    connect(m_chapterScroller, SIGNAL(change(int)), SLOT(slotStepChapter(int)));
    connect(m_chapterScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock()));
    connect(m_chapterScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock()));
    connect(m_verseScroller, SIGNAL(change(int)), SLOT(slotStepVerse(int)));
    connect(m_verseScroller, SIGNAL(scroller_pressed()), SLOT(slotUpdateLock()));
    connect(m_verseScroller, SIGNAL(scroller_released()), SLOT(slotUpdateUnlock()));
    bool ok = connect(m_key->afterChangedSignaller(), SIGNAL(signal()), this, SLOT(updateText()));
    Q_ASSERT(ok);

    setKey(key);    // The order of these two functions is important.
    setModule();
}
Exemplo n.º 17
0
QWidget* MusicVideoControl::createBarrageWidget()
{
    QWidget *barrageWidget = new QWidget(this);
    m_pushBarrageOn = false;

    ///////////////////////////////////////////
    QWidgetAction *widgetAction = new QWidgetAction(barrageWidget);
    QWidget *barrageSettingWidget = new QWidget(barrageWidget);
    QVBoxLayout *settingLayout = new QVBoxLayout(barrageSettingWidget);

    QWidget *fontSizeWidget = new QWidget(barrageSettingWidget);
    QHBoxLayout *fontSizeLayout = new QHBoxLayout(fontSizeWidget);
    fontSizeLayout->setContentsMargins(0, 0, 0, 0);
    QLabel *fontSizeLabel = new QLabel(tr("Size"), this);

    QButtonGroup *fontSizeButtonGroup = new QButtonGroup(fontSizeWidget);
    fontSizeLayout->addWidget(fontSizeLabel);
    for(int i=1; i<=3; ++i)
    {
        QPushButton *button = createBarrageSizeButton(i);
        fontSizeButtonGroup->addButton(button, i);
        fontSizeLayout->addStretch(1);
        fontSizeLayout->addWidget(button);
    }
    fontSizeLayout->addStretch(1);
    fontSizeWidget->setLayout(fontSizeLayout);
    connect(fontSizeButtonGroup, SIGNAL(buttonClicked(int)), SLOT(barrageSizeButtonClicked(int)));

    QWidget *backgroundWidget = new QWidget(barrageSettingWidget);
    QHBoxLayout *backgroundLayout = new QHBoxLayout(backgroundWidget);
    backgroundLayout->setContentsMargins(0, 0, 0, 0);
    backgroundLayout->setSpacing(5);
    QLabel *backgroundLabel = new QLabel(tr("BgColor"), this);

    QButtonGroup *backgroundButtonGroup = new QButtonGroup(backgroundWidget);
    backgroundLayout->addWidget(backgroundLabel);
    for(int i=1; i<=8; ++i)
    {
        QPushButton *button = createBarrageColorButton(i);
        backgroundButtonGroup->addButton(button, i);
        backgroundLayout->addWidget(button);
    }
    backgroundWidget->setLayout(backgroundLayout);
    connect(backgroundButtonGroup, SIGNAL(buttonClicked(int)), SLOT(barrageColorButtonClicked(int)));

    settingLayout->addWidget(fontSizeWidget);
    settingLayout->addWidget(backgroundWidget);
    barrageSettingWidget->setLayout(settingLayout);

    widgetAction->setDefaultWidget(barrageSettingWidget);
    m_popupBarrage.addAction(widgetAction);
    ///////////////////////////////////////////

    QHBoxLayout *barrageLayout = new QHBoxLayout(barrageWidget);
    barrageLayout->setContentsMargins(0, 0, 0, 0);

    QToolButton *menuBarrage = new QToolButton(barrageWidget);
    menuBarrage->setStyleSheet(MusicUIObject::MToolButtonStyle04);
    menuBarrage->setIcon(QIcon(":/video/barrageStyle"));
    menuBarrage->setMenu(&m_popupBarrage);
    menuBarrage->setPopupMode(QToolButton::InstantPopup);
    MusicLocalSongSearchEdit *lineEditBarrage = new MusicLocalSongSearchEdit(barrageWidget);
    lineEditBarrage->addFilterText(tr("just one barrage!"));
    lineEditBarrage->setStyleSheet(MusicUIObject::MLineEditStyle01 + \
                                   "QLineEdit{color:white;}");
    connect(lineEditBarrage, SIGNAL(enterFinished(QString)), SIGNAL(addBarrageChanged(QString)));

    QLabel *labelBarrage = new QLabel(barrageWidget);
    labelBarrage->setStyleSheet("color:white;");
    labelBarrage->setText(tr("openBarrage"));
    m_pushBarrage = new QPushButton(barrageWidget);
    m_pushBarrage->setIconSize(QSize(40, 25));
    pushBarrageClicked();
    connect(m_pushBarrage, SIGNAL(clicked()), SLOT(pushBarrageClicked()));

    barrageLayout->addWidget(menuBarrage);
    barrageLayout->addWidget(lineEditBarrage);
    barrageLayout->addWidget(labelBarrage);
    barrageLayout->addWidget(m_pushBarrage);
    barrageWidget->setLayout(barrageLayout);

    return barrageWidget;
}
Exemplo n.º 18
-1
CCustomer::CCustomer(QWidget *parent) :
    QWidget(parent)
  , actualRecords(false)
  , ui(new Ui::CCustomer)
  , customerDialog(new CCustomerDialog(this)), customer_gDialog(new CCustomer_gDialog(this))
  , discountDialog(new CDiscountDialog(this))
  , addItem(new CAddItem(this))
  , focusedWidget(nullptr)
{
    ui->setupUi(this);

// model
    modelFaces    = new QStandardItemModel(this);
    modelPartner  = new QStandardItemModel(this);
    modelHuman    = new QStandardItemModel(this);

    modelSelectionFaces   = new QItemSelectionModel(modelFaces);
    modelSelectionPartner = new QItemSelectionModel(modelPartner);
    modelSelectionHuman   = new QItemSelectionModel(modelHuman);

// create #temporary table
    QString query ("SELECT * INTO #GroupCustomerDiscounts FROM ViewGroupCustomerDiscounts"
                   "SELECT * INTO #CustomerSubdiller FROM ViewCustomerSubdiller");
    QSqlQuery temporary(currentDatabase());
    temporary.exec(query);

    QSplitter *hSplitter = new QSplitter(Qt::Horizontal);
    QSplitter *vSplitter = new QSplitter(Qt::Vertical);

    QWidget *w1 = new QWidget(this);
    QWidget *w2 = new QWidget(this);

    treeFaces          = new QTreeView (this);
    treePartner        = new CCustomerTreeView (this);
    textEditPartnerComment = new QTextEdit (this);
    textEditPartnerComment->setMaximumWidth(100);
    textEditPartnerComment->setReadOnly(true);
    treeHuman          = new CCustomerTreeView (this);
    textEditHumanComment   = new QTextEdit (this);
    textEditHumanComment->setMaximumWidth(100);
    textEditHumanComment->setReadOnly(true);

    QHBoxLayout *hboxPartner = new QHBoxLayout(w1);
                 hboxPartner->setMargin(0);
                 hboxPartner->addWidget(treePartner);
                 hboxPartner->addWidget(textEditPartnerComment);

    QHBoxLayout *hboxHuman = new QHBoxLayout(w2);
                 hboxHuman->setMargin(0);
                 hboxHuman->addWidget(treeHuman);
                 hboxHuman->addWidget(textEditHumanComment);

    vSplitter->addWidget(w1);
    vSplitter->addWidget(w2);
    vSplitter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);

    ui->vLayoutUnionPartnerHuman->addWidget(vSplitter);

    hSplitter->addWidget(treeFaces);
    hSplitter->addWidget(vSplitter);
    hSplitter->setStretchFactor(1, 3);
    hSplitter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);

    ui->hLayoutUnionViews->addWidget(hSplitter);

    treeFaces->setObjectName("treeViewFaces");
    treeFaces->setModel(modelFaces);
    treeFaces->setSelectionModel(modelSelectionFaces);
    treeFaces->setEditTriggers(QAbstractItemView::NoEditTriggers);
    treeFaces->installEventFilter(this);

    treePartner->setObjectName("treeViewPartner");
    treePartner->setRootIsDecorated(false);
    treePartner->setAlternatingRowColors(true);
    treePartner->setModel(modelPartner);
    treePartner->setSelectionModel(modelSelectionPartner);
    treePartner->setEditTriggers(QAbstractItemView::NoEditTriggers);
    treePartner->installEventFilter(this);

    treeHuman->setObjectName("treeViewHuman");
    treeHuman->setRootIsDecorated(false);
    treeHuman->setAlternatingRowColors(true);
    treeHuman->setModel(modelHuman);
    treeHuman->setSelectionModel(modelSelectionHuman);
    treeHuman->setEditTriggers(QAbstractItemView::NoEditTriggers);
    treeHuman->installEventFilter(this);

    filter = new CFilter(this);
    filter->setObjectName("filter");
    filter->setPlaceholderText("Введите наименование");
    filter->installEventFilter(this);
    filter->setValidator(new QRegExpValidator(QRegExp(trUtf8("[а-яА-Яa-zA-Z0-9_]+")), this));
    ui->hLayoutSearchToItem->addWidget(filter);

    QToolButton *telephone = new QToolButton(this);
    QPixmap pixmapTelephone("data/picture/additionally/telephone.png");

    telephone->setIcon(QIcon(pixmapTelephone));
    telephone->setIconSize(QSize(24, 24));
    telephone->setCursor(Qt::PointingHandCursor);
    telephone->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    ui->hLayoutSearchToItem->addWidget(telephone);

    QToolButton *meeting = new QToolButton(this);
    QPixmap pixmapMeeting("data/picture/additionally/meeting.png");

    meeting->setIcon(QIcon(pixmapMeeting));
    meeting->setIconSize(QSize(24, 24));
    meeting->setCursor(Qt::PointingHandCursor);
    meeting->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    ui->hLayoutSearchToItem->addWidget(meeting);

    QToolButton *event = new QToolButton(this);
    QPixmap pixmapEvent("data/picture/additionally/event.png");

    event->setIcon(QIcon(pixmapEvent));
    event->setIconSize(QSize(24, 24));
    event->setCursor(Qt::PointingHandCursor);
    event->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    ui->hLayoutSearchToItem->addWidget(event);

    QToolButton *task = new QToolButton(this);
    QPixmap pixmapTask("data/picture/additionally/task.png");

    task->setIcon(QIcon(pixmapTask));
    task->setIconSize(QSize(24, 24));
    task->setCursor(Qt::PointingHandCursor);
    task->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    ui->hLayoutSearchToItem->addWidget(task);

    ui->labelCurrentUser->setText(QString("Пользователь: <b><u>" + currentUser() + "</u></b>"));

    mc.idCustomer      = -1;
    mc.nameCustomer    = QString("");

    root = new QStandardItem(QString("Заказчики"));
    root->setIcon(QIcon("data/picture/additionally/root.png"));
    modelFaces->insertColumns(0, FACES_MODEL_COLUMN_COUNT);
    modelFaces->setItem(0, 0, root);

    QFont font(treeFaces->font());
          font.setBold (true);
    modelFaces->setData(modelFaces->index(0, 0), font, Qt::FontRole);
    modelFaces->setHeaderData(0, Qt::Horizontal, QObject::tr("Наименование"));

    QVector<int> storage;
                 storage.append(1);
                 storage.append(2);
                 storage.append(3);
    CDictionaryCore::columnHidden(treeFaces, modelFaces, storage);
                 storage.clear();

    root->setChild(modelFaces->rowCount(root->index()), new QStandardItem("Загрузка..."));

    modelPartner->insertColumns(0, PARTNER_MODEL_COLUMN_COUNT);

    modelPartner->setHeaderData(0, Qt::Horizontal, "Контрагенты");
    modelPartner->setHeaderData(1, Qt::Horizontal, "Клиентский №");
    modelPartner->setHeaderData(2, Qt::Horizontal, "Телефон");
    modelPartner->setHeaderData(3, Qt::Horizontal, "Город");
    modelPartner->setHeaderData(4, Qt::Horizontal, "Web");
    modelPartner->setHeaderData(5, Qt::Horizontal, "Руководитель");

    modelHuman->insertColumns(0, HUMAN_MODEL_COLUMN_COUNT);

    modelHuman->setHeaderData(0, Qt::Horizontal, "ФИО");
    modelHuman->setHeaderData(1, Qt::Horizontal, "Отдел");
    modelHuman->setHeaderData(2, Qt::Horizontal, "Должность");
    modelHuman->setHeaderData(3, Qt::Horizontal, "Телефон");
    modelHuman->setHeaderData(4, Qt::Horizontal, "Приоритет");

//    connect(filter, SIGNAL(textChanged(QString)), SLOT(slotFindCities(QString)));
    connect(treeFaces, SIGNAL(expanded(QModelIndex)),  SLOT(slotFillGroup(QModelIndex)));
    connect(treeFaces, SIGNAL(collapsed(QModelIndex)), SLOT(slotClearGroup(QModelIndex)));
    connect(treeFaces, SIGNAL(clicked(QModelIndex)),   SLOT(slotFillPartner(QModelIndex)));

//    connect(treeViewCountry, SIGNAL(clicked(QModelIndex)),
//            this, SLOT(slotDataChanged(QModelIndex)));
//    connect(editDialogCountry, SIGNAL(saveDataChanged()), this, SLOT(slotInsertOrUpdateRecords()));
//    connect(editDialogCity, SIGNAL(saveDataChanged()), this, SLOT(slotInsertOrUpdateRecords()));
//    connect(addItem->ui->buttonSave, SIGNAL(clicked()), countryDialog, SLOT(show()));

    connect(addItem->ui->buttonSave, SIGNAL(clicked()), SLOT(slotShowEditDialog()));
    connect(addItem->ui->buttonSave, SIGNAL(clicked()), addItem, SLOT(close()));

    actualRecords
             ? ui->labelViewState->setText(QString(tr("Отображаются записи: <b><u>Актуальные</u></b>")))
             :
               ui->labelViewState->setText(QString(tr("Отображаются записи: <b><u>Все</u></b>")));
}