当前位置: 首页>>代码示例>>C++>>正文


C++ QTimer类代码示例

本文整理汇总了C++中QTimer的典型用法代码示例。如果您正苦于以下问题:C++ QTimer类的具体用法?C++ QTimer怎么用?C++ QTimer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QTimer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: messageType

/*
 * This function works pretty much like routTcpMessage only that this one interpretes message from RFIDMonitor and don't verify packages size.
 * it only tries to interpret data just arrived.
 */
void RFIDMonitorDaemon::routeIpcMessage()
{
    QByteArray message = ipcConnection->readAll();
    json::NodeJSMessage nodeMessage;

    nodeMessage.read(QJsonDocument::fromJson(message).object());
    QString messageType(nodeMessage.type());

    if(messageType == "SYN"){

        m_restoreTimer.stop();
        ipcSendMessage(buildMessage(QJsonObject(), "ACK-SYN").toJson());
        qApp->processEvents();

        /* When the deskApp change some configuration the RFIDMonitor is restarted.
         * But, the RFIDMonitor starts with flag connection=false. And if the server is connected the RFIDMonitor don't know that yet.
         * To solve this, after 1 seconds a SYNC message is sent to RFIDMonitor to set true to connection flag.
         */
        if(isConnected)
        {
            QTimer *timer = new QTimer();
            timer->setSingleShot(true);
            timer->setInterval(1000);
            connect(timer, &QTimer::timeout, [=](){
                ipcSendMessage(buildMessage(QJsonObject(), "SYNC").toJson());
                timer->deleteLater();
            });
            timer->start();
        }

        m_configManager->restartNetwork();

    }else if (messageType == "READER-RESPONSE") {
        QJsonObject command(nodeMessage.jsonData());
        /*
         * When a 'reader response' message is received is because someone sent a 'reader command' message. So it needs to know who did it.
         * To perform this it uses a field called 'sender' that carry the name of who sent the 'command message'.
         * And based on that, it will respond to the server connection or to the deskApp connection.
         *
         * see reoutTcpMessage (messageType == "READER-COMMAND")
         */
        if(command.value("sender").toString() == "server")
            tcpSendMessage(m_tcpSocket, message);
        else
            tcpSendMessage(m_tcpAppSocket, message);

    }else if (messageType == "DATA"){
        /*
         * A Data message means that the RFIDMonitor is trying to sync some data into the server. So, it just send this message to the server.
         */
//        qDebug() <<  "DATA Message Received from Monitor\n";
//        qDebug() <<  QString(QJsonDocument(nodeMessage.jsonData()).toJson());
        // Only a node.js server receives DATA messages.
        tcpSendMessage(m_tcpSocket, message);

    }else if (messageType == "STOPPED"){
        qDebug() << "STOPPED";
        m_process.kill();
//        qDebug() << "Process Killed, PID: " << m_process.pid();
    }
    else if (messageType == "ACK-UNKNOWN") {
        QJsonDocument unknown(nodeMessage.jsonData());
        QJsonObject dataObj(unknown.object().value("unknownmessage").toObject());
        qDebug() <<  "The Monitor don't understand the message type: "
                        << dataObj.value("type").toString();
    }
    else{
        /* When receives a message that can't be interpreted like any type is an unknown message.
         * In this case an ACK-UNKNOWN message is built and sent to the connection that received this message
         */
        qDebug() <<  "UNKNOWN MESSAGE";

        QJsonObject unknownObj;
        unknownObj.insert("unknownmessage", QJsonDocument::fromJson(message).object());
        unknownObj.insert("errorinfo", QString("Unknown message received"));

        ipcSendMessage(buildMessage(unknownObj, "ACK-UNKNOWN").toJson());
    }
}
开发者ID:gustavovaliati,项目名称:rfidmonitor,代码行数:83,代码来源:rfidmonitordaemon.cpp

示例2: QWidget

//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
tPerformanceWidget::tPerformanceWidget( tIInstrumentProductFactory* pProductFactory, QWidget* pParent )
: QWidget( pParent )
, m_Mode( tPerformanceWidget::eModeAuto )
{
    Assert( pProductFactory );
    if ( pProductFactory )
    {
        setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

        m_pLayout = new QGridLayout( this );
        m_pLayout->setSpacing( 0 );
        m_pLayout->setContentsMargins( 0, 0, 0, 0 );

        m_pGaugeStack = new tSlidingStackedWidget( this );
        m_pGaugeStack->setSpeed( 300 );
        m_pGaugeStack->setAnimation( QEasingCurve::OutQuad );
        m_pGaugeStack->setWrap( true );

        m_pLayout->addWidget( m_pGaugeStack, 0, 1, 2, 1 );

        tGaugeParams gaugeParams = tGaugeParams();
        gaugeParams.m_SliderParams.m_LeftHandScale = false;

        // Bar graphs
        m_pVmgPerfGraph = new tPerfSliderGauge( DATA_TYPE_SPEED_WATER, this, gaugeParams );
        m_pGaugeStack->addWidget( m_pVmgPerfGraph );
        m_Gauges << m_pVmgPerfGraph;

        m_pReachingPerfGraph = new tPerfSliderGauge( DATA_TYPE_POLAR_PERFORMANCE, this, gaugeParams );
        m_pGaugeStack->addWidget( m_pReachingPerfGraph );
        m_Gauges << m_pReachingPerfGraph;

        // Digital gauges
        m_pTargetBspGauge = pProductFactory->GetDigitalGauge( DATA_TYPE_TARGET_BOAT_SPEED, this );
        m_pTargetBspGauge->SetBorders( false, false, true, true );
        m_pTargetBspGauge->SetTaperedBorder( true, false );
        m_pLayout->addWidget( m_pTargetBspGauge, 0, 0 );
        m_Gauges << m_pTargetBspGauge;

        m_pTargetTwaGauge = pProductFactory->GetDigitalGauge( DATA_TYPE_TARGET_TRUE_WIND_ANGLE, this );
        m_pTargetTwaGauge->SetBorders( false, false, true, false );
        m_pTargetTwaGauge->SetTaperedBorder( false, true );
        m_pLayout->addWidget( m_pTargetTwaGauge, 1, 0 );
        m_Gauges << m_pTargetTwaGauge;

        m_pPolarSpeedGauge = pProductFactory->GetDigitalGauge( DATA_TYPE_POLAR_SPEED, this );
        m_pPolarSpeedGauge->SetBorders( false, false, true, true );
        m_pPolarSpeedGauge->SetTaperedBorder( true, false );
        m_pLayout->addWidget( m_pPolarSpeedGauge, 0, 0 );
        m_Gauges << m_pPolarSpeedGauge;

        m_pBoatSpeedGauge = pProductFactory->GetDigitalGauge( DATA_TYPE_SPEED_WATER, this );
        m_pBoatSpeedGauge->SetBorders( false, false, true, false );
        m_pBoatSpeedGauge->SetTaperedBorder( false, true );
        m_pLayout->addWidget( m_pBoatSpeedGauge, 1, 0 );
        m_Gauges << m_pBoatSpeedGauge;

        int dataBoxW = Widgets::GetThirdScreenWidth();

        m_pVmgPerfGraph->setFixedSize( Widgets::GetScreenWidth() - dataBoxW, Widgets::GetScreenHeight() );
        m_pReachingPerfGraph->setFixedSize( Widgets::GetScreenWidth() - dataBoxW, Widgets::GetScreenHeight() );
        m_pTargetBspGauge->setFixedSize( dataBoxW, Widgets::GetHalfScreenHeight() );
        m_pTargetTwaGauge->setFixedSize( dataBoxW, Widgets::GetHalfScreenHeight() );
        m_pPolarSpeedGauge->setFixedSize( dataBoxW, Widgets::GetHalfScreenHeight() );
        m_pBoatSpeedGauge->setFixedSize( dataBoxW, Widgets::GetHalfScreenHeight() );

        SetUpdateRates();
        Connect( tInstrumentDataManager::Instance(), SIGNAL( UpdateRatesChanged() ), this, SLOT( SetUpdateRates() ) );

        UpdatePerfGauge();
        QTimer* pTimer = new QTimer( this );
        pTimer->setInterval( 1000 );
        Connect( pTimer, SIGNAL( timeout() ), this, SLOT( UpdatePerfGauge() ) );
        pTimer->start();
    }
}
开发者ID:dulton,项目名称:53_hero,代码行数:79,代码来源:tPerformanceWidget.cpp

示例3: QMainWindow

BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    nWeight(0)
{
    resize(850, 550);
    setWindowTitle(tr("PsychoCoin") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
//.........这里部分代码省略.........
开发者ID:psyxcoin,项目名称:psyx,代码行数:101,代码来源:bitcoingui.cpp

示例4: main

int main(int argc, char **argv)
{
    MPI::Init(argc, argv);
    QApplication app(argc, argv);
    LibGeoDecomp::Typemaps::initializeMaps();

    MPI::Aint displacements[] = {0};
    MPI::Datatype memberTypes[] = {MPI::CHAR};
    int lengths[] = {sizeof(CanvasCell)};
    MPI::Datatype objType;
    objType = 
        MPI::Datatype::Create_struct(1, lengths, displacements, memberTypes);
    objType.Commit();

    MPI::Datatype particleType;
    lengths[0] = sizeof(Particle);
    particleType = 
        MPI::Datatype::Create_struct(1, lengths, displacements, memberTypes);
    particleType.Commit();

    ParticleWidget *widget = 0;
    CanvasInitializer *init = getInit1();
    
    HiParSimulator<CanvasCell, RecursiveBisectionPartition<2> > *sim = new HiParSimulator<CanvasCell, RecursiveBisectionPartition<2> >(
        init,
        MPILayer().rank() ? 0 : new NoOpBalancer(), 
        1000,
        1,
        particleType);
    std::cout << "Simulator created ...\n";
    // HiParSimulator<CanvasCell, RecursiveBisectionPartition<2> > sim(
    //     new CanvasInitializer(dim.x(), dim.y()),
    //     MPILayer().rank() ? 0 : new NoOpBalancer(), 
    //     1000,
    //     1,
    //     particleType);

    ForceSteerer *steerer = new ForceSteerer(1);
    sim->addSteerer(steerer);
    std::cout << "Steerer added ...\n";

    Storage * storage = 0;
    if (MPILayer().rank() == 0) {
        storage = new Storage;
        widget = new ParticleWidget(*storage, init->gridDimensions(), Qt::black);
        widget->resize(1000, 500);
        widget->show();
        std::cout << "Widget created ...\n";
    }

    sim->addWriter(new TracingWriter<CanvasCell>(100, 100000));
    sim->addWriter(new ParticleWriter(storage, init->gridDimensions(), 1, particleType));

    FakeSimulator fakeSim(sim);

    // DebugOutput logger;
    QTimer timer;
    QTimer timerGL;

    QObject::connect(&timer, SIGNAL(timeout()),
                     &fakeSim, SLOT(step()));
    // QObject::connect(&widget, SIGNAL(newFrame()),
    //                  &logger, SLOT(newFrame()));
    // QObject::connect(&widget, SIGNAL(forceRecorded(QPoint, QPoint)),
    //                  &logger, SLOT(addForce(QPoint, QPoint)));
    QObject::connect(storage,     SIGNAL(forceRecorded(QVector2D, QVector2D)),
                     steerer,    SLOT(addForce(QVector2D, QVector2D))); 
    QObject::connect(&timerGL, SIGNAL(timeout()), widget, SLOT(updateGL()));

    timer.start(10);
    timerGL.start(10);
    app.exec();

    delete sim;
    MPI::Finalize();
}
开发者ID:jotrk,项目名称:vanDouken,代码行数:76,代码来源:main.cpp

示例5: QDialog

CQplayerGUI::CQplayerGUI(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CQplayerGUI)
{
    translator = new MyTranslator(":/language_thai.ini");
    disableTimer.setSingleShot(true);
    disableTimer.setInterval(3000);
    connect(&disableTimer,SIGNAL(timeout()),this,SLOT(slot_disableTime()));
    versionCtrl = new VersionSender("RoomMedia",1,1,12,ZTools::getCarID());

    ztpmForTest = new ZTPManager(8319,QHostAddress("224.102.228.40"));
    connect(ztpmForTest,SIGNAL(readyRead()),this,SLOT(slot_procTestZtp()));


    ZTPManager* ztpm = new ZTPManager(6633,QHostAddress("224.102.228.41"));
    connect(ztpm,SIGNAL(readyRead()),this,SLOT(slot_turnOffHeart()));
    QTimer* timer = new QTimer();
    timer->setSingleShot(false);
    timer->setInterval(3000);
    timer->start();
    connect(timer,SIGNAL(timeout()),this,SLOT(sendHeart()));
    ui->setupUi(this);

    char buf[10];
    sprintf(buf,"%02d",ZTools::getCarID());
    ui->carIDLabel->setText(buf);

    btn[0] = ui->btn_ch0;
    btn[1] = ui->btn_ch1;
    btn[2] = ui->btn_ch2;
    btn[3] = ui->btn_ch3;
    btn[4] = ui->btn_ch4;
    btn[5] = ui->btn_ch5;
    btn[6] = ui->btn_ch6;
    btn[7] = ui->btn_ch7;
    btn[8] = ui->btn_ch8;

    stackPanel = new StackPanel(translator,ui->frameMovie);
    stackPanel->hide();
    GlobalInfo* global = GlobalInfo::getInstance();
    global->playerGui = this;
    WorkThread::getInstance()->start();
    setWindowFlags(Qt::FramelessWindowHint|(windowFlags() & (~Qt::WindowCloseButtonHint)));

    serial = new RoomPanel();
    cqAudio = new CQAudio(ui->frameMovie,stackPanel,0);
    media = new CQMedia(ui->frameMovie->winId(),0);
    connect(media,SIGNAL(error(CQGstBasic::ErrorType)),this,SLOT(onMediaSignal(CQGstBasic::ErrorType)));
    ui->sliderVlm->setSliderPosition(10);
//    QTimer::singleShot(1000,this,SLOT(on_btn_ch0_clicked()));
    channel = -1;
    playState = STOP;
    screenInit();

    updateTimer = new QTimer;
    updateTimer->setSingleShot(false);
    updateTimer->setInterval(1000);
    connect(updateTimer,SIGNAL(timeout()),this,SLOT(updateTime()));
    updateTimer->start();

    switchLanguage = new QTimer;
    switchLanguage->setSingleShot(false);
    connect(switchLanguage,SIGNAL(timeout()),this,SLOT(refresh()));
    switchLanguage->setInterval(10000);
    switchLanguage->start();
}
开发者ID:zhangxuran11,项目名称:RoomMedia,代码行数:66,代码来源:CQplayerGUI.cpp

示例6: qDebug

bool VehicleConfigurationHelper::saveChangesToController(bool save)
{
    qDebug() << "Saving modified objects to controller. " << m_modifiedObjects.count() << " objects in found.";
    const int OUTER_TIMEOUT = 3000 * 20; // 10 seconds timeout for saving all objects
    const int INNER_TIMEOUT = 2000; // 1 second timeout on every save attempt

    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    Q_ASSERT(pm);
    UAVObjectUtilManager *utilMngr     = pm->getObject<UAVObjectUtilManager>();
    Q_ASSERT(utilMngr);

    QTimer outerTimeoutTimer;
    outerTimeoutTimer.setSingleShot(true);

    QTimer innerTimeoutTimer;
    innerTimeoutTimer.setSingleShot(true);

    connect(utilMngr, SIGNAL(saveCompleted(int, bool)), this, SLOT(uAVOTransactionCompleted(int, bool)));
    connect(&innerTimeoutTimer, SIGNAL(timeout()), &m_eventLoop, SLOT(quit()));
    connect(&outerTimeoutTimer, SIGNAL(timeout()), this, SLOT(saveChangesTimeout()));

    outerTimeoutTimer.start(OUTER_TIMEOUT);
    for (int i = 0; i < m_modifiedObjects.count(); i++) {
        QPair<UAVDataObject *, QString> *objPair = m_modifiedObjects.at(i);
        m_transactionOK = false;
        UAVDataObject *obj     = objPair->first;
        QString objDescription = objPair->second;
        if (UAVObject::GetGcsAccess(obj->getMetadata()) != UAVObject::ACCESS_READONLY && obj->isSettings()) {
            emit saveProgress(m_modifiedObjects.count() + 1, ++m_progress, objDescription);

            m_currentTransactionObjectID = obj->getObjID();

            connect(obj, SIGNAL(transactionCompleted(UAVObject *, bool)), this, SLOT(uAVOTransactionCompleted(UAVObject *, bool)));
            while (!m_transactionOK && !m_transactionTimeout) {
                // Allow the transaction to take some time
                innerTimeoutTimer.start(INNER_TIMEOUT);

                // Set object updated
                obj->updated();
                if (!m_transactionOK) {
                    m_eventLoop.exec();
                }
                innerTimeoutTimer.stop();
            }
            disconnect(obj, SIGNAL(transactionCompleted(UAVObject *, bool)), this, SLOT(uAVOTransactionCompleted(UAVObject *, bool)));
            if (m_transactionOK) {
                qDebug() << "Object " << obj->getName() << " was successfully updated.";
                if (save) {
                    m_transactionOK = false;
                    m_currentTransactionObjectID = obj->getObjID();
                    // Try to save until success or timeout
                    while (!m_transactionOK && !m_transactionTimeout) {
                        // Allow the transaction to take some time
                        innerTimeoutTimer.start(INNER_TIMEOUT);

                        // Persist object in controller
                        utilMngr->saveObjectToFlash(obj);
                        if (!m_transactionOK) {
                            m_eventLoop.exec();
                        }
                        innerTimeoutTimer.stop();
                    }
                    m_currentTransactionObjectID = -1;
                }
            }

            if (!m_transactionOK) {
                qDebug() << "Transaction timed out when trying to save: " << obj->getName();
            } else {
                qDebug() << "Object " << obj->getName() << " was successfully saved.";
            }
        } else {
开发者ID:1heinz,项目名称:TauLabs,代码行数:72,代码来源:vehicleconfigurationhelper.cpp

示例7: QMainWindow

BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    nWeight(0)
{
    setFixedSize(970, 550);
	QFontDatabase::addApplicationFont(":/fonts/Bebas");
    setWindowTitle(tr("Pentaquark") + " - " + tr("Wallet"));
	qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none; } #frame { } QToolBar QLabel { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} QToolBar QLabel:item { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} #toolbar2 { border:none;width:0px;hight:0px;padding-top:40px;padding-bottom:0px; background-color: transparent; } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:red; } QMenu { background-color: qlineargradient(spread:pad, x1:0.511, y1:1, x2:0.482909, y2:0, stop:0 rgba(232,232,232), stop:1 rgba(232,232,232)); color: red; padding-bottom:10px; } QMenu::item { color: red; background: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgba(99,99,99,45), stop: 1 rgba(99,99,99,45)); } QMenuBar { background-color: white; color: red; } QMenuBar::item { font-size:12px;padding-bottom:3px;padding-top:3px;padding-left:15px;padding-right:15px;color: red; background-color: white; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgba(99,99,99,45), stop: 1 rgba(99,99,99,45)); }");
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/pentaquark"));
    setWindowIcon(QIcon(":icons/pentaquark"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();
    statisticsPage = new StatisticsPage(this);
    blockBrowser = new BlockBrowser(this);
    chatWindow = new ChatWindow(this);
#ifdef ENABLE_TRADE_REQUIRE_QT5
    tradingDialogPage = new tradingDialog(this);
    tradingDialogPage->setObjectName("tradingDialog");
#endif
//    radioPage = new Radio(this);

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(statisticsPage);
    centralWidget->addWidget(blockBrowser);
    centralWidget->addWidget(chatWindow);
#ifdef ENABLE_TRADE_REQUIRE_QT5
    centralWidget->addWidget(tradingDialogPage);
#endif
//    centralWidget->addWidget(radioPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar


    // Status bar notification icons
    labelEncryptionIcon = new QLabel();
	labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
	
	if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
//.........这里部分代码省略.........
开发者ID:PentaLHC,项目名称:PentaLHC,代码行数:101,代码来源:bitcoingui.cpp

示例8: menuBar

void Mwindow::initUI() {

    /* Menu */
    QMenu *fileMenu = menuBar()->addMenu("&File");
    QMenu *editMenu = menuBar()->addMenu("&Edit");

    QAction *Open    = new QAction("&Open", this);
    QAction *Quit    = new QAction("&Quit", this);
    QAction *playAc  = new QAction("&Play/Pause", this);
    QAction *aboutAc = new QAction("&About", this);

    Open->setShortcut(QKeySequence("Ctrl+O"));
    Quit->setShortcut(QKeySequence("Ctrl+Q"));

    fileMenu->addAction(Open);
    fileMenu->addAction(aboutAc);
    fileMenu->addAction(Quit);
    editMenu->addAction(playAc);

    connect(Open,    SIGNAL(triggered()), this, SLOT(openFile()));
    connect(playAc,  SIGNAL(triggered()), this, SLOT(play()));
    connect(aboutAc, SIGNAL(triggered()), this, SLOT(about()));
    connect(Quit,    SIGNAL(triggered()), qApp, SLOT(quit()));

    /* Buttons for the UI */
    playBut = new QPushButton("Play");
    QObject::connect(playBut, SIGNAL(clicked()), this, SLOT(play()));

    QPushButton *stopBut = new QPushButton("Stop");
    QObject::connect(stopBut, SIGNAL(clicked()), this, SLOT(stop()));

    QPushButton *muteBut = new QPushButton("Mute");
    QObject::connect(muteBut, SIGNAL(clicked()), this, SLOT(mute()));

    volumeSlider = new QSlider(Qt::Horizontal);
    QObject::connect(volumeSlider, SIGNAL(sliderMoved(int)), this, SLOT(changeVolume(int)));
    volumeSlider->setValue(80);

    slider = new QSlider(Qt::Horizontal);
    slider->setMaximum(1000);
    QObject::connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(changePosition(int)));

    /* A timer to update the sliders */
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(updateInterface()));
    timer->start(100);

    /* Central Widgets */
    QWidget* centralWidget = new QWidget;
    videoWidget = new QWidget;

    videoWidget->setAutoFillBackground( true );
    QPalette plt = palette();
    plt.setColor( QPalette::Window, Qt::black );
    videoWidget->setPalette( plt );

    /* Put all in layouts */
    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(playBut);
    layout->addWidget(stopBut);
    layout->addWidget(muteBut);
    layout->addWidget(volumeSlider);

    QVBoxLayout *layout2 = new QVBoxLayout;
    layout2->addWidget(videoWidget);
    layout2->addWidget(slider);
    layout2->addLayout(layout);

    centralWidget->setLayout(layout2);
    setCentralWidget(centralWidget);
    resize( 600, 400);
}
开发者ID:RodrigoNieves,项目名称:vlc,代码行数:72,代码来源:player.cpp

示例9: initializeGL

        void initializeGL(){
    {
		rotate_value = 0;
		constexpr static char vs[] = R"(#version 450
    layout(location=0) in vec4 iposition;
    layout(location=1) in vec4 inormal_  ;
    layout(location=1) uniform mat4 MVP ;
    layout(location=3) uniform mat4 NMVP ;
    layout(location=2) uniform vec4 light_pos = vec4(1,1,-1,1);
    out vec4 color ;
    void main(){
    gl_Position = MVP * iposition  ;
    vec4 inormal = NMVP * inormal_ ;
    vec3 light = light_pos.xyz - gl_Position.xyz ;
    light = normalize( light );
    float v = smoothstep(0,1, dot(light ,
    normalize( inormal.xyz ) ));
    v*=0.85;
    v+=0.05;
    color = vec4(v,v,v,1) ;
    }
    )";
        constexpr static char fs[] = R"(#version 450
    out vec4 fcolor ;
    in vec4 color ;
    void main(){
    fcolor = color ;
    }
    )";
        program = gl::VFProgramLoadSources(vs,fs);
    }
    glEnable(GL_CULL_FACE);
    glEnable(GL_DEPTH_TEST);
            glClearDepth(1);
            glClearColor(0,0,0,0);
    #ifdef _DEBUG_OPENGL_QT_
    QGLDebugTool::setSimpleCallbackFunction();
    QGLDebugTool::test();
    #endif
    gl::createBuffers(1, &pointsNormalBuffer);
    gl::createBuffers(1,&indexBuffer);

    {
        gl::VertexNormalElementCallBack callBack ;

        callBack.loadFile(
            ":/model.zip"
            );

        gl::bufferData(indexBuffer,
    callBack.triangles.size()*sizeof(callBack.triangles[0]),
    &callBack.triangles[0]
    );

        gl::bufferData(pointsNormalBuffer,
    callBack.pointNormal.size()*sizeof(callBack.pointNormal[0]),
    &callBack.pointNormal[0]);

		const double scale__ = (std::max)({
			double(callBack.xMax) - callBack.xMin ,
			double(callBack.yMax) - callBack.yMin,
			double(callBack.zMax) - callBack.zMin
		});

		modelScaleBase = glm::scale(glm::vec3(
            float( 1.50 / scale__),
            float( 1.50 / scale__),
            float(-1.50 / scale__)
            ));

		modelScale = modelScaleBase;
		normalMatrix = glm::mat4( 
			1,0, 0,0,
			0,1, 0,0,
			0,0,-1,0,
			0,0, 0,1
			);
        indexCount = 3 * callBack.triangles.size() ;
    }

    gl::createVertexArrays(1,&vao);
    vao.bindBuffer(0, pointsNormalBuffer, 0,
        sizeof(gl::Float) * 6, 0,
        gl::NamedVertexArrayObject::Size::Three);
    vao.bindBuffer(1, pointsNormalBuffer, 0,
        sizeof(gl::Float) * 6, sizeof(gl::Float) * 3,
        gl::NamedVertexArrayObject::Size::Three);
    vao.bindElementBuffer(indexBuffer);
	{
		typedef void(QTimer::*TT)();
		timer.connect( &timer,TT(&QTimer::timeout),
			[this]() {
			rotate();
			super->updateGL();
		}
			);
	}
	timer.start(666);
     }
开发者ID:ngzHappy,项目名称:OpenGL45Book,代码行数:99,代码来源:RotateNormalSphere.cpp

示例10: doit

void doit(vtkObject* vtkNotUsed(obj), unsigned long vtkNotUsed(event),
          void* client_data, void* vtkNotUsed(param))
{
  QTimer* t = reinterpret_cast<QTimer*>(client_data);
  t->stop();
}
开发者ID:bpayne,项目名称:CTK,代码行数:6,代码来源:ctkVTKConnectionTest1.cpp

示例11: num_of_colors


//.........这里部分代码省略.........
#ifdef CGAL_USE_CORE
  // Conic Type Group
  QActionGroup *conicTypeGroup = new QActionGroup( this ); // Connected later
  conicTypeGroup->setExclusive( TRUE );

  setCircle = new QAction("Circle",
                                 QPixmap( (const char**)demo_conic_circle_xpm ),
                                 "&Circle", 0 ,conicTypeGroup,
                                 "Circle" );
  setCircle->setToggleAction( TRUE );
  setSegment = new QAction("Segment",
                                 QPixmap( (const char**)demo_conic_segment_xpm ),
                                 "&Segment", 0 ,conicTypeGroup,
                                 "Segment" );
  setSegment->setToggleAction( TRUE );
  setEllipse = new QAction("Ellipse",
                                 QPixmap( (const char**)demo_conic_ellipse_xpm ),
                                 "&Ellipse", 0 ,conicTypeGroup,
                                 "Ellipse" );
  setEllipse->setToggleAction( TRUE );
  setParabola = new QAction("3 Points Arc",
                                 QPixmap( (const char**)demo_conic_3points_xpm ),
                                 "&3 Points Arc", 0 ,conicTypeGroup,
                                 "3 Points Arc" );
  setParabola->setToggleAction( TRUE );
  setHyperbola = new QAction("5 Points Arc",
                                 QPixmap( (const char**)demo_conic_5points_xpm ),
                                 "&5 Points Arc", 0 ,conicTypeGroup,
                                 "5 Points Arc" );
  setHyperbola->setToggleAction( TRUE );
#endif
*/
  //create a timer for checking if somthing changed
  QTimer *timer = new QTimer( this );
  connect( timer, SIGNAL(timeout()),
           this, SLOT(timer_done()) );
  timer->start( 200, FALSE );

  // file menu
  QPopupMenu * file = new QPopupMenu( this );
  menuBar()->insertItem( "&File", file );
  /*
  file->insertItem("&Open Segment File...", this, SLOT(fileOpenSegment()));
  file->insertItem("&Open Polyline File...", this, SLOT(fileOpenPolyline()));\
  file->insertItem("&Open Segment Arr File...", this, SLOT(fileOpenSegmentPm()));
  file->insertItem("&Open Polyline Arr File...", this, SLOT(fileOpenPolylinePm()));
  file->insertItem("&Open Conic Pm File", this, SLOT(fileOpenConicPm()));
  */
  file->insertItem("&Open Input File...", this, SLOT(fileOpenSegment()));
  file->insertItem("&Open Output File...", this, SLOT(fileOpenConic()));

  file->insertItem("&Save...", this, SLOT(fileSave()));
  file->insertItem("&Save As...", this, SLOT(fileSaveAs()));
  //file->insertItem("&Save to ps...", this, SLOT(fileSave_ps()));
  file->insertSeparator();
  file->insertItem("&Print...", this , SLOT(print()));
  file->insertSeparator();
  file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X );
  file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );
  menuBar()->insertSeparator();

  // tab menu
  QPopupMenu * tab = new QPopupMenu( this );
  menuBar()->insertItem( "&Tab", tab );
/*
  tab->insertItem("Add &Segment Tab", this, SLOT(add_segment_tab()));
开发者ID:Jankaemper,项目名称:CAC,代码行数:67,代码来源:arrangement_2.cpp

示例12: QMainWindow


//.........这里部分代码省略.........

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelMintingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelMintingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    labelEncryptionIcon->setObjectName("labelEncryptionIcon");
    labelConnectionsIcon->setObjectName("labelConnectionsIcon");
    labelBlocksIcon->setObjectName("labelBlocksIcon");
    labelMintingIcon->setObjectName("labelMintingIcon");
    labelEncryptionIcon->setStyleSheet("#labelEncryptionIcon QToolTip {color:#cecece;background-color:#333333;border:0px;}");
    labelConnectionsIcon->setStyleSheet("#labelConnectionsIcon QToolTip {color:#cecece;background-color:#333333;border:0px;}");
    labelBlocksIcon->setStyleSheet("#labelBlocksIcon QToolTip {color:#cecece;background-color:#333333;border:0px;}");
    labelMintingIcon->setStyleSheet("#labelMintingIcon QToolTip {color:#cecece;background-color:#333333;border:0px;}");

    // Set minting pixmap
    labelMintingIcon->setPixmap(QIcon(":/icons/minting").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
    labelMintingIcon->setEnabled(false);
    // Add timer to update minting icon
    QTimer *timerMintingIcon = new QTimer(labelMintingIcon);
    timerMintingIcon->start(MODEL_UPDATE_DELAY);
    connect(timerMintingIcon, SIGNAL(timeout()), this, SLOT(updateMintingIcon()));
    // Add timer to update minting weights
    QTimer *timerMintingWeights = new QTimer(labelMintingIcon);
    timerMintingWeights->start(30 * 1000);
    connect(timerMintingWeights, SIGNAL(timeout()), this, SLOT(updateMintingWeights()));
    // Set initial values for user and network weights
    nWeight, nNetworkWeight = 0;

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);
    statusBar()->setObjectName("cloakStatusBar");
    statusBar()->setStyleSheet("#cloakStatusBar { border-top-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4B4F52, stop:0.5 #8B8F92, stop:1.0 #8B8F92); border-top-width: 2px; border-top-style: inset; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #666666, stop:0.5 #323232, stop:1.0 #111111); background-image: url(:images/shadowbar); background-repeat: repeat-x; background-position: bottom center; color: #ffffff; } QToolTip { color: #ffffff; background-color: #9D0000; border-width: 1px;border-color:#CA0D0D;}");

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);
    // this->setStyleSheet("background-color: #effbef;");

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
开发者ID:JamesAndersson,项目名称:OHLC,代码行数:101,代码来源:bitcoingui.cpp

示例13: append

void MapQuestRunner::retrieveRoute( const RouteRequest *route )
{
    if ( route->size() < 2 ) {
        return;
    }

    QHash<QString, QVariant> settings = route->routingProfile().pluginSettings()["mapquest"];

    if ( settings.value( "appKey" ).toString().isEmpty() )
    {
        return;
    }

    QString url = "http://open.mapquestapi.com/directions/v1/route?callback=renderAdvancedNarrative&outFormat=xml&narrativeType=text&shapeFormat=raw&generalize=0";
    GeoDataCoordinates::Unit const degree = GeoDataCoordinates::Degree;
    append( &url, "from", QString::number( route->source().latitude( degree ), 'f', 6 ) + ',' + QString::number( route->source().longitude( degree ), 'f', 6 ) );
    for ( int i=1; i<route->size(); ++i ) {
        append( &url, "to", QString::number( route->at( i ).latitude( degree ), 'f', 6 ) + ',' + QString::number( route->at( i ).longitude( degree ), 'f', 6 ) );
    }

    QString const unit = MarbleGlobal::getInstance()->locale()->measurementSystem() == MarbleLocale::MetricSystem ? "k" : "m";
    append( &url, "units", unit );

    if ( settings["noMotorways"].toInt() ) {
        append( &url, "avoids", "Limited Access" );
    }
    if ( settings["noTollroads"].toInt() ) {
        append( &url, "avoids", "Toll road" );
    }
    if ( settings["noFerries"].toInt() ) {
        append( &url, "avoids", "Ferry" );
    }

    if ( !settings["preference"].toString().isEmpty() ) {
        append( &url, "routeType", settings["preference"].toString() );
    }

    if ( !settings["ascending"].toString().isEmpty() && !settings["descending"].toString().isEmpty() ) {
            if ( settings["ascending"].toString() == "AVOID_UP_HILL"
                       && settings["descending"].toString() == "AVOID_DOWN_HILL" ) {
                append( &url, "roadGradeStrategy", "AVOID_ALL_HILLS" );
            }
            else if ( settings["ascending"].toString() == "FAVOR_UP_HILL"
                         && settings["descending"].toString() == "FAVOR_DOWN_HILL" ) {
                append( &url, "roadGradeStrategy", "FAVOR_ALL_HILLS" );
            }
            else if ( settings["ascending"].toString() == "DEFAULT_STRATEGY"
                         && settings["descending"].toString() == "DEFAULT_STRATEGY" ) {
                append( &url, "roadGradeStrategy", "DEFAULT_STRATEGY" );
            }
            else if ( settings["ascending"].toString() == "DEFAULT_STRATEGY" ) {
                append( &url, "roadGradeStrategy", settings["descending"].toString() );
            }
            else if ( settings["descending"].toString() == "DEFAULT_STRATEGY" ) {
                append( &url, "roadGradeStrategy", settings["ascending"].toString() );
            }
            else if ( settings["descending"].toString() == "AVOID_DOWN_HILL" ) {
                append( &url, "roadGradeStrategy", settings["descending"].toString() );
            }
            else if ( settings["ascending"].toString() == "AVOID_UP_HILL" ) {
                append( &url, "roadGradeStrategy", settings["ascending"].toString() );
            }
        }
    QUrl qurl(url);
// FIXME: verify that this works with special characters.
#if QT_VERSION >= 0x050000
    QUrlQuery urlQuery;
    urlQuery.addQueryItem( "key", settings.value( "appKey" ).toByteArray() );
    qurl.setQuery(urlQuery);
#else
    qurl.addEncodedQueryItem( "key", settings.value( "appKey" ).toByteArray() );
#endif
    m_request.setUrl( qurl );
    m_request.setRawHeader( "User-Agent", HttpDownloadManager::userAgent( "Browser", "MapQuestRunner" ) );

    QEventLoop eventLoop;

    QTimer timer;
    timer.setSingleShot( true );
    timer.setInterval( 15000 );

    connect( &timer, SIGNAL(timeout()),
             &eventLoop, SLOT(quit()));
    connect( this, SIGNAL(routeCalculated(GeoDataDocument*)),
             &eventLoop, SLOT(quit()) );

    // @todo FIXME Must currently be done in the main thread, see bug 257376
    QTimer::singleShot( 0, this, SLOT(get()) );
    timer.start();

    eventLoop.exec();
}
开发者ID:abhgangwar,项目名称:marble,代码行数:92,代码来源:MapQuestRunner.cpp

示例14: QMainWindow


//.........这里部分代码省略.........
    createActions(networkStyle);

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create system tray icon and notification
    createTrayIcon(networkStyle);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    unitDisplayControl = new UnitDisplayStatusBarControl();
    labelStakingIcon = new QLabel();
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QPushButton();
    labelConnectionsIcon->setFlat(true); // Make the button look like a label, but clickable
    labelConnectionsIcon->setStyleSheet(".QPushButton { background-color: rgba(255, 255, 255, 0);}");
    labelConnectionsIcon->setMaximumSize(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE);
    labelBlocksIcon = new QLabel();

    if(enableWallet)
    {
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(unitDisplayControl);
        frameBlocksLayout->addStretch();
        frameBlocksLayout->addWidget(labelEncryptionIcon);
    }
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(true);
    progressBar = new GUIUtil::ProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(true);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = QApplication::style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #F8F8F8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #00CCFF, stop: 1 #33CCFF); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    // Jump directly to tabs in RPC-console
    connect(openInfoAction, SIGNAL(triggered()), rpcConsole, SLOT(showInfo()));
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(showConsole()));
    connect(openNetworkAction, SIGNAL(triggered()), rpcConsole, SLOT(showNetwork()));
    connect(openPeersAction, SIGNAL(triggered()), rpcConsole, SLOT(showPeers()));
    connect(openRepairAction, SIGNAL(triggered()), rpcConsole, SLOT(showRepair()));
    connect(openConfEditorAction, SIGNAL(triggered()), rpcConsole, SLOT(showConfEditor()));
    connect(showBackupsAction, SIGNAL(triggered()), rpcConsole, SLOT(showBackups()));
    connect(labelConnectionsIcon, SIGNAL(clicked()), rpcConsole, SLOT(showPeers()));

    // Get restart command-line parameters and handle restart
    connect(rpcConsole, SIGNAL(handleRestart(QStringList)), this, SLOT(handleRestart(QStringList)));

    // prevents an open debug window from becoming stuck/unusable on client shutdown
    connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide()));

    connect(openTradingwindowAction, SIGNAL(triggered()), tradingWindow, SLOT(show()));

    // prevents an oben debug window from becoming stuck/unusable on client shutdown
    connect(quitAction, SIGNAL(triggered()), tradingWindow, SLOT(hide()));

    // Install event filter to be able to catch status tip events (QEvent::StatusTip)
    this->installEventFilter(this);

    // Initially wallet actions should be disabled
    setWalletActionsEnabled(false);

    // Subscribe to notifications from core
    subscribeToCoreSignals();

    QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
    connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(setStakingStatus()));
    timerStakingIcon->start(10000);
    setStakingStatus();
}
开发者ID:Darknet-Crypto,项目名称:Darknet,代码行数:101,代码来源:bitcoingui.cpp

示例15: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // Align last toolbar action to the right
    QWidget *empty = new QWidget(this);
    empty->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
    ui->mainToolBar->insertWidget(ui->actionMonitor, empty);

    // Align last action to the right in the monitor toolbar
    QWidget *emptyMonitor = new QWidget(this);
    emptyMonitor->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);
    ui->monitorToolBar->insertWidget(ui->actionMonitor, emptyMonitor);
    // Hide monitor toolbar
    ui->monitorToolBar->setVisible(false);

    // Hide graphs widget
    ui->graphsWidget->setVisible(false);

    // Set monospaced font in the monitor
    const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
    ui->consoleText->setFont(fixedFont);

    // Set environment
    settings = new SettingsStore(CONFIG_INI);
    setArduinoBoard();
    xmlFileName = "";
    serial = NULL;

    // Set zoom scale of the web view
    float zoomScale = settings->zoomScale();
    ui->webView->setZoomFactor(zoomScale);

    // Hide messages
    actionCloseMessages();
    serialPortClose();

    // Load blockly index
    loadBlockly();

    // Set timer to update list of available ports
    updateSerialPorts();
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(updateSerialPorts()));
    timer->start(5000);

    ui->consoleText->document()->setMaximumBlockCount(100);

    // Show/hide icon labels in the menu bar
    iconLabels();

    // Set process
    process = new QProcess();
    process->setProcessChannelMode(QProcess::MergedChannels);
    connect(process,
            SIGNAL(started()),
            this,
            SLOT(onProcessStarted()));
    connect(process,
            SIGNAL(readyReadStandardOutput()),
            this,
            SLOT(onProcessOutputUpdated()));
    connect(process,
            SIGNAL(finished(int)),
            this,
            SLOT(onProcessFinished(int)));

    // Show opened file name in status bar
    connect(statusBar(),
            SIGNAL(messageChanged(QString)),
            this,
            SLOT(onStatusMessageChanged(QString)));

    // Filter events to capture backspace key
    ui->webView->installEventFilter(this);
}
开发者ID:vrruiz,项目名称:visualino,代码行数:78,代码来源:mainwindow.cpp


注:本文中的QTimer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。