Ejemplo n.º 1
0
void TabBarPrivate::layoutButtons()
{
    int bw = tabbar->height();
    int w = tabbar->width();
    offset = bw * 4;

    if (tabbar->isLeftToRight()) {
        scrollFirstButton->setGeometry(0, 0, bw, bw);
        scrollFirstButton->setIcon(QIcon(QPixmap(arrow_leftmost_xpm)));
        scrollBackButton->setGeometry(bw, 0, bw, bw);
        scrollBackButton->setIcon(QIcon(QPixmap(arrow_left_xpm)));
        scrollForwardButton->setGeometry(bw*2, 0, bw, bw);
        scrollForwardButton->setIcon(QIcon(QPixmap(arrow_right_xpm)));
        scrollLastButton->setGeometry(bw*3, 0, bw, bw);
        scrollLastButton->setIcon(QIcon(QPixmap(arrow_rightmost_xpm)));
    } else {
        scrollFirstButton->setGeometry(w - bw, 0, bw, bw);
        scrollFirstButton->setIcon(QIcon(QPixmap(arrow_rightmost_xpm)));
        scrollBackButton->setGeometry(w - 2*bw, 0, bw, bw);
        scrollBackButton->setIcon(QIcon(QPixmap(arrow_right_xpm)));
        scrollForwardButton->setGeometry(w - 3*bw, 0, bw, bw);
        scrollForwardButton->setIcon(QIcon(QPixmap(arrow_left_xpm)));
        scrollLastButton->setGeometry(w - 4*bw, 0, bw, bw);
        scrollLastButton->setIcon(QIcon(QPixmap(arrow_leftmost_xpm)));
    }
}
void MusicProgressWidget::initWidget()
{
    m_background = new QLabel(this);
    m_background->setGeometry(20, 20, 360, 115);
    QWidget *backgroundMask = new QWidget(this);
    backgroundMask->setGeometry(20, 45, 360, 90);
    backgroundMask->setStyleSheet("background:rgba(255,255,255,200);");

    QLabel *topTitleName = new QLabel(this);
    topTitleName->setText(tr("Progress Bar"));
    topTitleName->setGeometry(30, 20, 221, 25);
    topTitleName->setStyleSheet("color:#FFFFFF;font-weight:bold;");

    QToolButton *topTitleCloseButton = new QToolButton(this);
    topTitleCloseButton->setGeometry(360, 22, 20, 20);
    topTitleCloseButton->setIcon(QIcon(":/share/searchclosed"));
    topTitleCloseButton->setStyleSheet(MusicUIObject::MToolButtonStyle03);
    topTitleCloseButton->setEnabled(false);

    m_progressBar = new QProgressBar(this);
    setBar(m_progressBar);
    m_progressBar->setStyleSheet(MusicUIObject::MProgressBar01);

    m_textLabel = new QLabel(this);
    m_textLabel->setAlignment(Qt::AlignCenter);
    m_textLabel->setGeometry(40, 50, 320, 25);
}
Ejemplo n.º 3
0
Login::Login(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Login)
{
    ui->setupUi(this);

    #pragma region 窗口初始化
	ui->Editline_Password->setEchoMode(QLineEdit::Password);
    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/dialogBG.png");
    palette.setBrush(ui->Under->backgroundRole(),QBrush(pixmap));
    ui->Under->setPalette(palette);
    ui->Under->setMask(pixmap.mask());  //可以将图片中透明部分显示为透明的
    ui->Under->setAutoFillBackground(true);
    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(410-46,100,20,20);
    closeButton->setGeometry(410-25,100,20,20);
    //设置鼠标移至按钮上的提示信息
    minButton->setToolTip(tr("最小化"));
    closeButton->setToolTip(tr("关闭"));
    //设置最小化、关闭按钮的样式
    minButton->setStyleSheet("background-color:transparent;");
    closeButton->setStyleSheet("background-color:transparent;");
#pragma endregion 窗口初始化
    reset_flag = 0;

    ui -> Frame_error ->hide();
}
Ejemplo n.º 4
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("记住密码");

}
Ejemplo n.º 5
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();
}
Ejemplo n.º 6
0
ViewReadLinetree3::ViewReadLinetree3( bool open,
                                                                        QWidget* parent,
                                                                    const char* name,
                                                                        bool modal,
                                                                        WFlags fl )
    : QDialog( parent, name, modal, fl ),
        __open(open)
{
    if ( !name )
        setName( "ViewReadLinetree3" );
    resize( 500, 250 );
    if(open)setCaption( tr( "Read Linetree" ) );
        else setCaption( tr( "Save Linetree" ) );

    buttonLig = new QToolButton( this, "buttonLig" );
    buttonLig->setGeometry( QRect( 450, 10, 40, 21 ) );
    buttonLig->setText( tr( "..." ) );
    QObject::connect( buttonLig,SIGNAL(clicked()),this,SLOT(SelectLigFile()));

    QLabel * labelDta = new QLabel( this, "labelDta" );
    labelDta->setGeometry( QRect( 10, 60, 61, 20 ) );
    labelDta->setText( tr( "Dta File" ) );

    buttonDta = new QToolButton( this, "buttonDta" );
    buttonDta->setGeometry( QRect( 450, 60, 40, 21 ) );
    buttonDta->setText( tr( "..." ) );
    QObject::connect( buttonDta,SIGNAL(clicked()),this,SLOT(SelectDtaFile()));

    QLabel * labelSmb = new QLabel( this, "labelSmb" );
    labelSmb->setGeometry( QRect( 10, 110, 61, 20 ) );
    labelSmb->setText( tr( "SMB Path" ) );

    buttonSmb = new QToolButton( this, "buttonSmb" );
    buttonSmb->setGeometry( QRect( 450, 110, 40, 21 ) );
    buttonSmb->setText( tr( "..." ) );
    QObject::connect( buttonSmb,SIGNAL(clicked()),this,SLOT(SelectSMBPath()));

    QLabel * labelLig = new QLabel( this, "labelLig" );
    labelLig->setGeometry( QRect( 10, 10, 61, 20 ) );
    labelLig->setText( tr( "Lig File" ) );

    editLig = new QLineEdit( this, "editLig" );
    editLig->setGeometry( QRect( 100, 10, 350, 22 ) );

    editDta = new QLineEdit( this, "editDta" );
    editDta->setGeometry( QRect( 100, 60, 350, 22 ) );
        if(!DTA_FILENAME.isEmpty())editDta->setText( tr(DTA_FILENAME) );

    editSmb = new QLineEdit( this, "editSmb" );
    editSmb->setGeometry( QRect( 100, 110, 350, 22 ) );
	if(SMB_PATH.isEmpty())    {
	  SMB_PATH = (TOOLS(getPlantGLDir())+"share/plantgl/SMBFiles").c_str() ;
	}
    if(!SMB_PATH.isEmpty())editSmb->setText( tr( SMB_PATH ) );

    labelKey = new QLabel( this, "labelKey" );
    labelKey->setGeometry( QRect( 10, 160, 89, 20 ) );
    if(open)labelKey->setText( tr( "Key :" ) );
        else labelKey->setText("Key : [AMAPmod]");

    editKey = new QLineEdit( this, "editKey" );
    editKey->setGeometry( QRect( 100, 160, 350, 22 ) );
        editKey->setReadOnly(open);
        editKey->setFont(QFont("courier", 8));
        QPalette pal = editKey->palette();
    QColorGroup cg = pal.active();
    cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) );
    pal.setActive( cg );
        cg = pal.inactive();
    cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) );
    pal.setInactive( cg );
        cg = pal.disabled();
    cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) );
    pal.setDisabled( cg );
    editKey->setProperty( "palette", pal );
    editKey->setEchoMode(QLineEdit::Password);
    if(!open)editKey->setText(PGL(LinetreePrinter)::PROTECTION.c_str());
    QObject::connect( editKey,SIGNAL(textChanged(const QString&)),this,SLOT(checkKey(const QString&)));
	DblClickEater * dblCkEater = new DblClickEater(editKey);
    labelKey->installEventFilter( dblCkEater );

        if(!open){
                QToolButton * buttonKey = new QToolButton( this, "buttonKey" );
                buttonKey->setGeometry( QRect( 450, 160, 40, 21 ) );
                buttonKey->setText( tr( "Reset" ) );
                QObject::connect( buttonKey,SIGNAL(clicked()),this,SLOT(resetKey()));
        }


    buttonCancel = new QPushButton( this, "buttonCancel" );
    buttonCancel->setGeometry( QRect( 390, 200, 104, 28 ) );
    buttonCancel->setText( tr( "&Cancel" ) );
    QObject::connect( buttonCancel,SIGNAL(clicked()),this,SLOT(reject()));

    buttonOk = new QPushButton( this, "buttonOk" );
    buttonOk->setGeometry( QRect( 280, 200, 104, 28 ) );
    buttonOk->setText( tr( "&Ok" ) );
    QObject::connect( buttonOk,SIGNAL(clicked()),this,SLOT(ok()));

    endianBox = new QCheckBox( this, "endianBox" );
    endianBox->setGeometry( QRect( 10, 205, 90, 20 ) );
	endianBox->setText( tr( "Big Endian" ) );
	endianBox->setChecked(true);

    if(open){
    QPushButton * buttonTestEndianess = new QPushButton( this, "TestEndianess" );
    buttonTestEndianess->setGeometry( QRect( 100, 200, 54, 28 ) );
    buttonTestEndianess->setText( tr( "Test" ) );
    QObject::connect( buttonTestEndianess,SIGNAL(clicked()),this,SLOT(testEndianess()));
	}

	if(!LIG_FILENAME.isEmpty()){
       editLig->setText( tr(LIG_FILENAME) );
       checkKey();
	}

}
Ejemplo n.º 7
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区");
}