示例#1
0
int Message::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: sendButtonClicked(); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
void VideoControlsWidget::setUpUI()
{
    //instantiate the labels
#if !USE_COMBO_BOX
    this->lblWidth = new QLabel("W:",this);
    this->lblHeight = new QLabel("H:",this);
#else
    this->lblWidthHeight = new QLabel("WxH:", this);
#endif

    this->lblFPS = new QLabel("FPS:",this);
    this->lblbitRate = new QLabel("Bps:",this);

    //instantiate the line edits
#if !USE_COMBO_BOX
    this->leWidth = new QLineEdit(this);
    this->leHeight = new QLineEdit(this);
    this->leFPS = new QLineEdit(this);
#else
    //Instantiate the combo box
    this->cbResolution = new QComboBox(this);
    //Populate the combo box
    QByteArray pathname = qgetenv("INTELLIGENT_CAMERA_SYSTEM_ROOT_DIR");
    QString filename(pathname);
    filename += "/";
    filename += STANDARD_RESOLUTIONS_FILE;
    FileReaderUtility reader(filename);
    if(reader.open_file())
    {
        this->all_sizes = reader.parse();
        this->cbResolution->addItems(all_sizes);
    }
    else
    {
        //If file fails to open... do something (will determine)

    }
    this->cbFps = new QComboBox(this);
    this->cbFps->addItem("30");
    this->cbFps->addItem("15");
#endif

    this->lebitRate = new QLineEdit(this);




    //Instantiate the SEND button
    this->bSend = new QPushButton("SEND", this);
    //this->bSend->setStyleSheet("border: 1px solid #1b1b1b; border-radius: 2px");
    this->setFocusPolicy(Qt::NoFocus);
    connect(bSend, SIGNAL(clicked()), this, SLOT(sendButtonClicked()));
    //Set up the layouts
#if !USE_COMBO_BOX
    QHBoxLayout *widths = new QHBoxLayout;
    widths->addWidget(lblWidth);
    widths->addWidget(leWidth);

    QHBoxLayout *heights = new QHBoxLayout;
    heights->addWidget(lblHeight);
    heights->addWidget(leHeight);

    QHBoxLayout *FPSLayout = new QHBoxLayout;
    FPSLayout->addWidget(lblFPS);
    FPSLayout->addWidget(leFPS);
#else
    QHBoxLayout *resolution = new QHBoxLayout;
    resolution->addWidget(lblWidthHeight);
    resolution->addWidget(cbResolution);

    QHBoxLayout *FPSLayout = new QHBoxLayout;
    FPSLayout->addWidget(lblFPS);
    FPSLayout->addWidget(cbFps);
#endif


    QHBoxLayout *BPSLayout = new QHBoxLayout;
    BPSLayout->addWidget(lblbitRate);
    BPSLayout->addWidget(lebitRate);


    //Main layout
    QHBoxLayout *layout = new QHBoxLayout;
#if !USE_COMBO_BOX
    layout->addLayout(widths);
    layout->addLayout(heights);
#else
    layout->addLayout(resolution);
#endif
    layout->addLayout(FPSLayout);
    layout->addLayout(BPSLayout);
    //layout->addSpacing(20);
    layout->addWidget(bSend);

//    QHBoxLayout *button = new QHBoxLayout;
//    button->addSpacing(300);
//    button->addWidget(bSend);


//    QVBoxLayout *main = new QVBoxLayout;
//    main->addLayout(layout);
//    main->addLayout(button);

    this->setLayout(layout);


}
示例#3
0
    void CChatWidget::initWidget()
    {
        QGridLayout* pMainLayout = new QGridLayout(this);
        setLayout(pMainLayout);

        m_pChatListWidget = new QWidget(this);
        pMainLayout->addWidget(m_pChatListWidget, 0, 0, 10, 2, Qt::AlignLeft);

        m_pPeerInfoWidget = new QWidget(this);
        pMainLayout->addWidget(m_pPeerInfoWidget, 0, 2, 2, 8);
        QHBoxLayout* pPeerInfoLayout = new QHBoxLayout(m_pPeerInfoWidget);
        m_pPeerInfoWidget->setLayout(pPeerInfoLayout);
        pPeerInfoLayout->addWidget(new QLabel(tr("name"), m_pPeerInfoWidget));
        pPeerInfoLayout->addWidget(new QLabel(tr("ip"), m_pPeerInfoWidget));
        pPeerInfoLayout->addWidget(new QLabel(tr("port"), m_pPeerInfoWidget));

        m_pRecordWidget = new QWidget(this);
        m_pRecordWidget->setLayout(new QVBoxLayout(m_pRecordWidget));
        QScrollArea* pLogArea = new QScrollArea(this);
        pLogArea->setWidget(m_pRecordWidget);
        pLogArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        pLogArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
        pMainLayout->addWidget(pLogArea, 2, 2, 5, 8);

        pLogArea->setWidgetResizable(true);
        pLogArea->setStyleSheet(
                    "QWidget{background-color: transparent;} QScrollArea{background-color: rgba(255, 255, 255, 59);}");

        m_psbRecord = pLogArea->verticalScrollBar();

        QWidget* pInputWidget = new QWidget(this);
        pMainLayout->addWidget(pInputWidget, 7, 2, 3, 8);
        QHBoxLayout* pInputLayout = new QHBoxLayout(pInputWidget);
        pInputWidget->setLayout(pInputLayout);
        m_pteInput = new QTextEdit(pInputWidget);
        pInputLayout->addWidget(m_pteInput);
        QPushButton* pbtnSend = new QPushButton(tr("send"), pInputWidget);
        pInputLayout->addWidget(pbtnSend);

        bool VARIABLE_IS_NOT_USED bIsSendConOK = connect(pbtnSend, SIGNAL(clicked()), this, SLOT(sendButtonClicked()));
        Q_ASSERT(bIsSendConOK);
    }