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


C++ QTimer::setInterval方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
				.arg(ccGlobalShiftManager::MaxCoordinateAbsValue(), 0, 'e', 0)
				.arg(ccGlobalShiftManager::MaxBoundgBoxDiagonal(), 0, 'e', 0));
		}

		if (argc > lastArgumentIndex)
		{
			if (splash)
			{
				splash->close();
			}

			//any additional argument is assumed to be a filename --> we try to load it/them
			QStringList filenames;
			for (int i = lastArgumentIndex; i < argc; ++i)
			{
				QString arg(argv[i]);
				//special command: auto start a plugin
				if (arg.startsWith(":start-plugin:"))
				{
					QString pluginName = arg.mid(14);
					QString pluginNameUpper = pluginName.toUpper();
					//look for this plugin
					bool found = false;
					for (const tPluginInfo &plugin : plugins)
					{
						if (plugin.object->getName().replace(' ', '_').toUpper() == pluginNameUpper)
						{
							found = true;
							bool success = plugin.object->start();
							if (!success)
							{
								ccLog::Error(QString("Failed to start the plugin '%1'").arg(plugin.object->getName()));
							}
							break;
						}
					}

					if (!found)
					{
						ccLog::Error(QString("Couldn't find the plugin '%1'").arg(pluginName.replace('_', ' ')));
					}
				}
				else
				{
					filenames << arg;
				}
			}

			mainWindow->addToDB(filenames);
		}
		else if (splash)
		{
			//count-down to hide the timer (only effective once the application will have actually started!)
			QObject::connect(&splashTimer, &QTimer::timeout, [&]() { if (splash) splash->close(); QCoreApplication::processEvents(); splash.reset(); });
			splashTimer.setInterval(1000);
			splashTimer.start();
		}

		//change the default path to the application one (do this AFTER processing the command line)
		QDir::setCurrent(workingDir.absolutePath());

		//let's rock!
		try
		{
			result = app.exec();
		}
		catch (...)
		{
			QMessageBox::warning(0, "CC crashed!", "Hum, it seems that CC has crashed... Sorry about that :)");
		}

		//release the plugins
		for (tPluginInfo &plugin : plugins)
		{
			plugin.object->stop(); //just in case
			if (!plugin.qObject->parent())
			{
				delete plugin.object;
				plugin.object = 0;
				plugin.qObject = 0;
			}
		}
	}

	//release global structures
	MainWindow::DestroyInstance();
	FileIOFilter::UnregisterAll();

#ifdef CC_TRACK_ALIVE_SHARED_OBJECTS
	//for debug purposes
	unsigned alive = CCShareable::GetAliveCount();
	if (alive > 1)
	{
		printf("Error: some shared objects (%u) have not been released on program end!",alive);
		system("PAUSE");
	}
#endif

	return result;
}
开发者ID:luca-penasa,项目名称:trunk,代码行数:101,代码来源:main.cpp

示例2: QDockWidget

SerialConsole::SerialConsole(QWidget *parent) :
    QDockWidget(tr("Serial console"), parent)
{
	setObjectName("SerialConsole");

    extruder_temperature = 0.0;
    bed_temperature = 0.0;
    nb_processed_commands = 0;
    start_time.start();

    QWidget *widget = new QWidget;
    setWidget(widget);
    QVBoxLayout *layout = new QVBoxLayout;
    widget->setLayout(layout);

    QComboBox *serial_ports = new QComboBox;

	const QList<QSerialPortInfo> &available_ports = QSerialPortInfo::availablePorts();
	for(const QSerialPortInfo &port : available_ports)
    {
        serial_ports->addItem(QIcon::fromTheme("printer"), port.portName(), port.portName());
    }
    connect(serial_ports,SIGNAL(activated(QString)),this,SLOT(connectTo(QString)));

    QHBoxLayout *history_layout = new QHBoxLayout;
    scroll_bar = new QScrollBar(Qt::Vertical);
    scroll_bar->setMinimum(0);
    scroll_bar->setValue(0);
    history_layout->addWidget(history = new SimpleTextEdit);
	history->setMaxSize(10000);
    history_layout->addWidget(scroll_bar);
    connect(history,SIGNAL(scrollPositionChanged(int)),scroll_bar,SLOT(setValue(int)));
    connect(scroll_bar,SIGNAL(valueChanged(int)),history,SLOT(setScrollPosition(int)));
    connect(history,SIGNAL(maxScrollChanged(int)),this,SLOT(updateScrollBar(int)));

    layout->addWidget(serial_ports);
    layout->addLayout(history_layout);
    layout->addWidget(cmd = new QLineEdit);

    history->setFocusPolicy(Qt::NoFocus);
    cmd->setFocusPolicy(Qt::StrongFocus);

	rs232 = new QSerialPort(this);
	rs232->setBaudRate(115200);

    connect(rs232,SIGNAL(readyRead()),this,SLOT(readMessage()));
    connect(cmd,SIGNAL(returnPressed()),this,SLOT(sendMessage()));

    ack_timer = new QTimer(this);
    ack_timer->setSingleShot(true);
    ack_timer->setInterval(2000);
    connect(ack_timer,SIGNAL(timeout()),this,SLOT(kickAfterTimeout()));

    QTimer *timer = new QTimer(this);
    timer->setInterval(10000);
    timer->setSingleShot(false);
    connect(timer,SIGNAL(timeout()),this,SLOT(requestTemperature()));
    timer->start();

    ack_expected_before_sending_a_command = 0;
    b_paused = false;

    QSettings settings;
    settings.beginGroup("SerialConsole");
    const QString &serial_port = settings.value("serial_port", QString()).toString();
    settings.endGroup();

    int idx = 0;
	for(const QSerialPortInfo &port : available_ports)
        if (port.portName() == serial_port)
        {
            serial_ports->setCurrentIndex(idx);
            connectTo(serial_port);
            break;
        }
        else
            ++idx;
}
开发者ID:francknos,项目名称:QRepRap_1.0,代码行数:78,代码来源:serialconsole.cpp

示例3: routeIpcMessage

/*
 * 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

示例4: main


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

			//any additional argument is assumed to be a filename --> we try to load it/them
			QStringList filenames;
			for (int i = lastArgumentIndex; i < argc; ++i)
			{
				QString arg(argv[i]);
				//special command: auto start a plugin
				if (arg.startsWith(":start-plugin:"))
				{
					QString pluginName = arg.mid(14);
					QString pluginNameUpper = pluginName.toUpper();
					//look for this plugin
					bool found = false;
					for ( ccPluginInterface *plugin : ccPluginManager::pluginList() )
					{
						if (plugin->getName().replace(' ', '_').toUpper() == pluginNameUpper)
						{
							found = true;
							bool success = plugin->start();
							if (!success)
							{
								ccLog::Error(QString("Failed to start the plugin '%1'").arg(plugin->getName()));
							}
							break;
						}
					}

					if (!found)
					{
						ccLog::Error(QString("Couldn't find the plugin '%1'").arg(pluginName.replace('_', ' ')));
					}
				}
				else
				{
					filenames << QString::fromLocal8Bit(argv[i]);
				}
			}

			mainWindow->addToDB(filenames);
		}
		else if (splash)
		{
			//count-down to hide the timer (only effective once the application will have actually started!)
			QObject::connect(&splashTimer, &QTimer::timeout, [&]() { if (splash) splash->close(); QCoreApplication::processEvents(); splash.reset(); });
			splashTimer.setInterval(1000);
			splashTimer.start();
		}

		//change the default path to the application one (do this AFTER processing the command line)
		QDir  workingDir = QCoreApplication::applicationDirPath();
		
	#ifdef Q_OS_MAC
		// This makes sure that our "working directory" is not within the application bundle	
		if ( workingDir.dirName() == "MacOS" )
		{
			workingDir.cdUp();
			workingDir.cdUp();
			workingDir.cdUp();
		}
	#endif

		QDir::setCurrent(workingDir.absolutePath());

		//let's rock!
		try
		{
			result = app.exec();
		}
		catch (const std::exception& e)
		{
			QMessageBox::warning(0, "CC crashed!", QString("Hum, it seems that CC has crashed... Sorry about that :)\n") + e.what());
		}
		catch (...)
		{
			QMessageBox::warning(0, "CC crashed!", "Hum, it seems that CC has crashed... Sorry about that :)");
		}

		//release the plugins
		for ( ccPluginInterface *plugin : ccPluginManager::pluginList() )
		{
			plugin->stop(); //just in case
		}
	}

	//release global structures
	MainWindow::DestroyInstance();
	FileIOFilter::UnregisterAll();

#ifdef CC_TRACK_ALIVE_SHARED_OBJECTS
	//for debug purposes
	unsigned alive = CCShareable::GetAliveCount();
	if (alive > 1)
	{
		printf("Error: some shared objects (%u) have not been released on program end!",alive);
		system("PAUSE");
	}
#endif

	return result;
}
开发者ID:MrCairo90,项目名称:CloudCompare,代码行数:101,代码来源:main.cpp

示例5: startTimerForTimeStamps

void ChatWindow::startTimerForTimeStamps() {
    QTimer* timer = new QTimer(this);
    timer->setInterval(10 * 60 * 1000);
    connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
    timer->start();
}
开发者ID:CoderPaulK,项目名称:hifi,代码行数:6,代码来源:ChatWindow.cpp

示例6: data

void Reader_RFM008B::readData()
{
    if(m_serial->canReadLine()){
        if(!allLines){

//            Logger::instance()->writeRecord(Logger::severity_level::debug, m_module, Q_FUNC_INFO, QString("Reading Data..."));

            QByteArray buffer = m_serial->readAll();
            QRegExp regex;
            regex.setPattern("(L(\\d{2})?W)\\s([0-9a-fA-F]{4})\\s([0-9a-fA-F]{16})");

            QString data(buffer);
            data.remove(QRegExp("[\\n\\t\\r]"));

            //        if(m_outReceived.device()){
            //            m_outReceived << data;
            //            m_outReceived.flush();
            //        }


            int pos = regex.indexIn(data);
            if(pos != -1){
                // The first string in the list is the entire matched string.
                // Each subsequent list element contains a string that matched a
                // (capturing) subexpression of the regexp.
                QStringList matches = regex.capturedTexts();

                // crear RFIDData
                QRegularExpression regexCode;
                regexCode.setPattern("([0-9a-fA-F]{4})(\\s)([0-9a-fA-F]{16})");
                QRegularExpressionMatch match = regexCode.match(matches.at(0));

                if(m_outCaptured.device()){
                    m_outCaptured << matches.at(0);
                    m_outCaptured.flush();
                }

                if(match.hasMatch()) {
                    Rfiddata *data = new Rfiddata(this);

                    // Id collector from configuration file
                    data->setIdpontocoleta(idCollector);

                    // This module can read from only one antena, so the idAntena is static.
                    int idAntena = 1;
                    data->setIdantena(idAntena);

                    qlonglong applicationcode = match.captured(1).toLongLong();
                    qlonglong identificationcode = match.captured(3).toLongLong();

                    /*
                 * Filter by time. If more than one transponder was read in a time interval only one of them will be persisted.
                 * A QMap is used to verify if each new data that had arrived was already read in this interval.
                 */
                    if(!m_map.contains(identificationcode)){

                        QTimer *timer = new QTimer;
                        timer->setSingleShot(true);
                        timer->setInterval(1000);
                        connect(timer, &QTimer::timeout,
                                [=, this]()
                        {
                            this->m_map.remove(identificationcode);
                            timer->deleteLater();
                        });
                        m_map.insert(identificationcode, timer);
                        timer->start();

                        data->setApplicationcode(applicationcode);
                        data->setIdentificationcode(identificationcode);
                        data->setDatetime(QDateTime::currentDateTime());
                        data->setSync(Rfiddata::KNotSynced);

                        QList<Rfiddata*> list;
                        list.append(data);
                        try {
                            PersistenceInterface *persister = qobject_cast<PersistenceInterface *>(RFIDMonitor::instance()->defaultService(ServiceType::KPersister));
                            Q_ASSERT(persister);
                            SynchronizationInterface *synchronizer = qobject_cast<SynchronizationInterface*>(RFIDMonitor::instance()->defaultService(ServiceType::KSynchronizer));
                            Q_ASSERT(synchronizer);

#ifdef CPP_11_ASYNC
                            /*C++11 std::async Version*/
                            std::function<void(const QList<Rfiddata *>&)> persistence = std::bind(&PersistenceInterface::insertObjectList, persister, std::placeholders::_1);
                            std::async(std::launch::async, persistence, list);
                            std::function<void()> synchronize = std::bind(&SynchronizationInterface::readyRead, synchronizer);
                            std::async(std::launch::async, synchronize);
#else
                            /*Qt Concurrent Version*/
                            QtConcurrent::run(persister, &PersistenceInterface::insertObjectList, list);
                            QtConcurrent::run(synchronizer, &SynchronizationInterface::readyRead);
#endif
                        } catch (std::exception &e) {
                            Logger::instance()->writeRecord(Logger::severity_level::fatal, m_module, Q_FUNC_INFO, e.what());
                        }
                    }
                }
            }
        }else{

//.........这里部分代码省略.........
开发者ID:CELTAB,项目名称:rfidmonitor,代码行数:101,代码来源:reader_rfm008b.cpp

示例7: CSupervision

CWinMainControler::CWinMainControler(CListStream* argAnalyseur,CCarteIO* argCarteIO,CCarteMesure* argCarteMesure, CSocketIHM* argInterfaceIHM)
    :m_CurrentGraphPage(0)
{
	qDebug() << "#### CWinMainControler::CWinMainControler" << endl;
	
	m_pSupervision = new CSupervision();
	m_pSupervision->setAnalyseur((CAnalyseur*)argAnalyseur);
	m_pSupervision->setCarteMesure(argCarteMesure);
	m_pSupervision->setCarteIO(argCarteIO);
	m_pSupervision->setInterfaceIHM(argInterfaceIHM);

	//Fenêtre alarme
	m_pDialogAlarm = new CDialogAlarm(m_pSupervision);
   
    //Fenêtre principale
	m_pView  = new CWinMainView(this);
	m_pModel = new CWinMainModel(m_pSupervision, m_pView);
	m_pView->setModel(m_pModel);

    //Construction des objets avant pour plus de fluidité  
	CWinElecTestControler::getInstance(this);
    CWinMaintenanceControler::getInstance(this);
    CWinSchedulerControler::getInstance(this);
    CWinStreamControler::getInstance(this);  

    //Construction de toutes les boites de dialog
    CDialogStopCycle::getInstance();
    CDialogCopyFiles::getInstance();
    CDialogInfo::getInstance();
    CDialogMessage::getInstance();
    CDialogPassword::getInstance();
    CDialogPaveNum::getInstance();
    CDialogRestauration::getInstance();
    CDialogResultatEtalon::getInstance();
    CDialogValEtalon::getInstance();
    
	CUserSession::getInstance()->objectRegister(this);

	
	//Controles de la fenêtre principale
	m_bEnStop = false;
	m_bEnPause = false;
	
	QPixmapCache::setCacheLimit(128);
	qDebug() << "#### FIN CWinMainControler::CWinMainControler" << endl;

	//récupération des erreurs
	QTimer* timerGetError = new QTimer(this);
	timerGetError->setInterval(1000);
	connect(timerGetError, SIGNAL(timeout()), this, SLOT(getErrorIOAndJBus()));
	timerGetError->start();
	
#ifdef SCREENSHOTS
	m_nbScreenshot = 0;
	QTimer* timerScreenShot = new QTimer(this);
	timerScreenShot->setInterval(3000);
	connect(timerScreenShot, SIGNAL(timeout()), this, SLOT(takeScreenshot()));
	timerScreenShot->start();
	//Fin screenshot
#endif

}
开发者ID:benoitk,项目名称:cristalqt_linux,代码行数:62,代码来源:CWinMainControler.cpp

示例8: QMainWindow

RemoteOM::RemoteOM(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::RemoteOM)
{

    mapResponse[48] = "No fault";
    mapResponse[49] = "IP. Plate current too high.";
    mapResponse[50] = "HV. Plate/anode voltage too low.";
    mapResponse[51] = "SWR. Excessive reflected power.";
    mapResponse[52] = "Ig2. Screen limit exceeded.";
    mapResponse[53] = "Overdrive. Too much drive from exciter.";
    mapResponse[54] = "FWD=0, Power output is zero with drive power higher than zero.";
    mapResponse[55] = "Igmax. 1st grid current limit exceeded.";
    mapResponse[56] = "Tune. Insufficient tuning - retune PA";
    mapResponse[62] = "PA turned on.";
    mapResponse[60] = "PA turned off.";
    mapResponse[83] = "PA turned to stand by mode.";
    mapResponse[79] = "PA turned to operating mode.";
    mapResponse[76] = "List 20 last fault codes.";
    mapResponse[71] = "Reset PA succeeded.";
    mapResponse[87] = "PA is heating up. Please wait.";
    mapResponse[90] = "Operating is not possible.";
    mapResponse[84] = "Fatal fault.";

    dialog = new SettingsDialog();

    ui->setupUi(this);
    createActions();

    //Init settings if startprofile is empty
    if (startProfile.isEmpty())
    {
        dialog->FirstChoice(startProfile.remove("\""));
        startProfile = "";
    }

    QTimer *timer = new QTimer(this);
    timer->setInterval(1000);
    timer->start();
    connect(timer, SIGNAL(timeout()), this, SLOT(TimeOut()));


    ui->menu->addAction(configureAct);
    ui->menu->addAction(exitAct);
    ui->ledDrive->hide();
    ui->ledGrid->hide();
    ui->ledOperate->hide();
    ui->ledPA->hide();
    ui->ledPower->hide();
    ui->ledStdby->hide();
    ui->ledSwr->hide();
    ui->ledTune->hide();
    ui->ledFault->hide();

    connect(ui->buttonConnect, SIGNAL(clicked()), this, SLOT(connectSocket()));
    socket = new QTcpSocket(this);
    ui->buttonPower->setStatusTip(tr("Turn PA ON/OFF."));
    ui->buttonOperate->setStatusTip(tr("Turn Operate ON/OFF."));
    ui->buttonConnect->setStatusTip(tr("Connect/Disconnect to Remote OM"));

    setInfoText("Connecting to Remote OM. Please wait.");

    receiveFaults = false;

    faultTimer = new QTimer(this);
    waitTimer = new QTimer(this);
    connect(faultTimer, SIGNAL(timeout()), this, SLOT(blinkFault()));
    connect(waitTimer, SIGNAL(timeout()), this, SLOT(blinkWait()));

    //Get settings
    if (!startProfile.isEmpty())
    {
       /* dialog->SetInitialSettings();
        QString show_ip = dialog->set_ipaddress;
        QString show_port = dialog->set_port;
        ui->txtCurrentSettings->setText("Current settings: "+show_ip+":"+show_port);*/
    }

}
开发者ID:Adminotech,项目名称:remoteom,代码行数:79,代码来源:remoteom.cpp

示例9: setInterval

void QTimerProto::setInterval(int msec)
{
  QTimer *item = qscriptvalue_cast<QTimer*>(thisObject());
  if (item)
    item->setInterval(msec);
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:6,代码来源:qtimerproto.cpp

示例10: QWidget


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


    outerLayout->addSpacing(20);
    outerLayout->addWidget(new HorizontalSeperator(QColor(66, 139, 202), 2));
    outerLayout->addSpacing(20);



    //  ######   #####  #####   ##    ##
    //  ##   ## ##   ## ##  ###  ##  ##
    //  ##   ## ##   ## ##   ##   ####
    //  ######  ##   ## ##   ##    ##
    //  ##   ## ##   ## ##   ##    ##
    //  ##   ## ##   ## ##  ###    ##
    //  ######   #####  #####      ##

    // Use a vertical splitter to divide the areas.

    splitter = new Splitter(Qt::Vertical);
    outerLayout->addWidget(splitter);
    splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);



    // The first area is a large text editing widget, this is
    // used to edit the proof's body.
    // The QTextEdit does its own scrolling.

    bodyTextEdit = new QTextEdit();

    QFont font = bodyTextEdit->font();
    font.setFamily("Courier");
    font.setPointSize(12);
    bodyTextEdit->setFont(font);

    bodyHighlighter = new LatexHighlighter(bodyTextEdit->document());

    splitter->addWidget(bodyTextEdit);

    QTimer *bodySaveTimer = new QTimer(this);
    bodySaveTimer->setSingleShot(true);
    bodySaveTimer->setInterval(200);

    connect(bodyTextEdit, SIGNAL(textChanged()), bodySaveTimer, SLOT(start()));
    connect(bodySaveTimer, SIGNAL(timeout()), this, SLOT(saveBody()));



    // The second area contains the rendered body.

    QScrollArea *bodyScrollArea = new QScrollArea();
    bodyScrollArea->setWidgetResizable(true);
    bodyScrollArea->setFrameShape(QFrame::NoFrame);

    QWidget *bodyWidget = new QWidget();

    QPalette palette = bodyWidget->palette();
    palette.setColor(QPalette::Background, Qt::white);
    bodyWidget->setPalette(palette);
    bodyWidget->setAutoFillBackground(true);

    bodyImage = new ResizableImage("");

    QHBoxLayout *bodyHLayout = new QHBoxLayout();
    bodyHLayout->addStretch(1);
    bodyHLayout->addWidget(bodyImage);
    bodyHLayout->addStretch(1);

    QVBoxLayout *bodyVLayout = new QVBoxLayout();
    bodyVLayout->addLayout(bodyHLayout);
    bodyVLayout->addStretch(1);

    bodyWidget->setLayout(bodyVLayout);
    bodyScrollArea->setWidget(bodyWidget);
    splitter->addWidget(bodyScrollArea);



    //  #####  ####  #####  ##   ##   ###   ##       #####
    // ##   ##  ##  ##   ## ###  ##  ## ##  ##      ##   ##
    //  ##      ##  ##      ###  ## ##   ## ##       ##
    //   ###    ##  ##      ####### ##   ## ##        ###
    //     ##   ##  ##  ### ##  ### ####### ##          ##
    // ##   ##  ##  ##   ## ##  ### ##   ## ##      ##   ##
    //  #####  ####  #####  ##   ## ##   ## #######  #####

    connect(editProofButton, SIGNAL(clicked()), this, SLOT(proofEditButtonClicked()));

    connect(proofEditDialog, SIGNAL(accepted()), this, SLOT(proofEditDialogCompleted()));
    connect(proofEditDialog, SIGNAL(rejected()), proofEditDialog, SLOT(close()));

    connect(deleteProofButton, SIGNAL(clicked()), proofDeleteDialog, SLOT(show()));

    connect(proofDeleteDialog, SIGNAL(accepted()), this, SLOT(proofDeleteDialogAccepted()));
    connect(proofDeleteDialog, SIGNAL(rejected()), proofDeleteDialog, SLOT(close()));

    connect(model, SIGNAL(proofSelectedChanged(Proof)), this, SLOT(proofSelectedChangedSlot(Proof)));
    connect(model, SIGNAL(proofEdited(Proof)), this, SLOT(proofEditedSlot(Proof)));
    connect(model, SIGNAL(proofDeleted(int)), this, SLOT(proofDeletedSlot(int)));
}
开发者ID:robertbrignull,项目名称:StudyAid,代码行数:101,代码来源:proofPage.cpp

示例11: initUI

void ShutDownFrame::initUI() {
    m_btnsList = new QList<RoundItemButton *>;
    m_shutdownButton = new RoundItemButton(tr("Shut down"));
    m_shutdownButton->setAutoExclusive(true);
    m_shutdownButton->setObjectName("ShutDownButton");
    m_restartButton = new RoundItemButton(tr("Restart"));
    m_restartButton->setAutoExclusive(true);
    m_restartButton->setObjectName("RestartButton");
    m_suspendButton = new RoundItemButton(tr("Suspend"));
    m_suspendButton->setAutoExclusive(true);
    m_suspendButton->setObjectName("SuspendButton");
    m_lockButton = new RoundItemButton(tr("Lock"));
    m_lockButton->setAutoExclusive(true);
    m_lockButton->setObjectName("LockButton");
    m_logoutButton = new RoundItemButton(tr("Log out"));
    m_logoutButton->setAutoExclusive(true);
    m_logoutButton->setObjectName("LogoutButton");

    m_switchUserBtn = new RoundItemButton(tr("Switch user"));
    m_switchUserBtn->setAutoExclusive(true);
    m_switchUserBtn->setObjectName("SwitchUserButton");

    QLabel *tipsIcon = new QLabel;
    tipsIcon->setPixmap(QPixmap(":/img/waring.png"));
    m_tipsLabel = new QLabel;
    m_tipsLabel->setAlignment(Qt::AlignCenter);
    m_tipsLabel->setStyleSheet("color:white;"
                               "font-size:14px;");
    QHBoxLayout *tipsLayout = new QHBoxLayout;
    tipsLayout->addStretch();
    tipsLayout->addWidget(tipsIcon);
    tipsLayout->addWidget(m_tipsLabel);
    tipsLayout->addStretch();

    m_tipsWidget = new QWidget;
    m_tipsWidget->hide();
    m_tipsWidget->setLayout(tipsLayout);

    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->setMargin(0);
    buttonLayout->setSpacing(10);
    buttonLayout->addStretch();
    buttonLayout->addWidget(m_shutdownButton);
    buttonLayout->addWidget(m_restartButton);
    buttonLayout->addWidget(m_suspendButton);
    buttonLayout->addWidget(m_lockButton);
    buttonLayout->addWidget(m_switchUserBtn);
    buttonLayout->addWidget(m_logoutButton);
    buttonLayout->addStretch(0);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);
    mainLayout->addStretch();
    mainLayout->addLayout(buttonLayout);
    mainLayout->addWidget(m_tipsWidget);
    mainLayout->addStretch();
    setFocusPolicy(Qt::StrongFocus);
    setLayout(mainLayout);

    updateStyle(":/skin/shutdown.qss", this);


    m_btnsList->append(m_shutdownButton);
    m_btnsList->append(m_restartButton);
    m_btnsList->append(m_suspendButton);
    m_btnsList->append(m_lockButton);
    m_btnsList->append(m_switchUserBtn);
    m_btnsList->append(m_logoutButton);

    m_currentSelectedBtn = m_shutdownButton;
    m_currentSelectedBtn->updateState(RoundItemButton::Default);

    //// Inhibit to shutdown
    inhibitShutdown();

    QTimer* checkTooltip = new QTimer(this);
    checkTooltip->setInterval(5*60*1000);
    checkTooltip->start();
    connect(checkTooltip,  &QTimer::timeout, this, &ShutDownFrame::inhibitShutdown);
}
开发者ID:Kirek,项目名称:deepin-session-ui-manjaro,代码行数:81,代码来源:contentwidget.cpp

示例12: QWidget

FacebookWidget::FacebookWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FacebookWidget)
{
    systemTrayIcon = new QSystemTrayIcon(QIcon(":/res/logo/Facebook-icon.png"));
    systemTrayMenu = new QMenu();
    notificationAction = new QAction(tr("Notifications"),this);
    friendRequestAction = new QAction(tr("Friend requests"),this);
    messagesAction = new QAction(tr("Messages"),this);
    quitAction = new QAction(tr("Quit"),this);
    windowVisibilityToggleAction = new QAction(tr("Hide"),this);
    aboutWindow = new AboutWindow();
    windowVisible = true;
    systemTrayMenu->addAction(windowVisibilityToggleAction);
    systemTrayMenu->addSeparator();
    systemTrayMenu->addAction(friendRequestAction);
    systemTrayMenu->addAction(messagesAction);
    systemTrayMenu->addAction(notificationAction);
    systemTrayMenu->addSeparator();
    systemTrayMenu->addAction(quitAction);
    systemTrayIcon->setContextMenu(systemTrayMenu);
    systemTrayIcon->show();
    themeSelectorWidget = new ThemeSelectorWidget();
    pressed = false;
    ui->setupUi(this);
    webView = new QWebView();
    ui->mainLayout->addWidget(webView);
    webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    this->setLayout(ui->mainLayout);
    connect(webView->page()->networkAccessManager(),SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),this,SLOT(sslErrorHandler(QNetworkReply*,QList<QSslError>)));
    connect(webView,SIGNAL(loadProgress(int)),ui->progressBar,SLOT(setValue(int)));
    connect(webView,SIGNAL(loadFinished(bool)),ui->progressBar,SLOT(reset()));
    connect(ui->backButton,SIGNAL(clicked()),webView,SLOT(back()));
    connect(ui->forwardButton,SIGNAL(clicked()),webView,SLOT(forward()));
    connect(ui->closeButton,SIGNAL(clicked()),this,SLOT(toggleWindowVisibility()));
    connect(quitAction,SIGNAL(triggered()),this,SLOT(quitActionTriggered()));
#ifndef Q_OS_MAC
    connect(systemTrayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(onSystemTrayClicked(QSystemTrayIcon::ActivationReason)));
#endif
    connect(friendRequestAction,SIGNAL(triggered()),this,SLOT(friendRequestActionTriggered()));
    connect(messagesAction,SIGNAL(triggered()),this,SLOT(messagesActionTriggered()));
    connect(notificationAction,SIGNAL(triggered()),this,SLOT(notificationActionTriggered()));
    connect(windowVisibilityToggleAction,SIGNAL(triggered()),this,SLOT(toggleWindowVisibility()));
    connect(webView->page(),SIGNAL(linkClicked(QUrl)),this,SLOT(delegateLink(QUrl)));
    connect(ui->aboutButton,SIGNAL(clicked()),aboutWindow,SLOT(show()));
    connect(ui->maximizeButton,SIGNAL(clicked()),this,SLOT(fullscreenToggle()));
    connect(ui->themeButton,SIGNAL(clicked()),themeSelectorWidget,SLOT(show()));
    connect(themeSelectorWidget,SIGNAL(applyTheme(QStringList)),this,SLOT(setTheme(QStringList)));
    connect(themeSelectorWidget,SIGNAL(useDefaultTheme()),this,SLOT(useDefaultTheme()));
    windowSizes << QRect(10,10,640,480);
    windowSizes << QRect(10,10,800,480);
    windowSizes << QRect(10,10,1030,600);
    windowSizes << desktopDetails.availableGeometry();
    windowSizeIndex = 2;
    setGeometry(windowSizes.at(2));
    setWindowFlags(Qt::FramelessWindowHint);
    themeRefreshTimer = new QTimer();
    QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled,true);
    QDir configDir = QDir::home();
    configDir.mkpath(".config/Socializer");
    configDir.mkpath(".config/Socializer/LocalStorage/");
    configDir.mkpath(".config/Socializer/OfflineStorage/");
    configDir.mkpath(".config/Socializer/IconDatabase/");
    configDir.mkpath(".config/Socializer/OfflineWebApplicationCache/");
    configDir.cd(".config/Socializer");
    configDir.cd("OfflineStorage");
    QWebSettings::setOfflineStoragePath(configDir.absolutePath());
    configDir.cdUp();
    configDir.cd("IconDatabase");
    QWebSettings::setIconDatabasePath(configDir.absolutePath());
    configDir.cdUp();
    configDir.cd("OfflineWebApplicationCache");
    QWebSettings::setOfflineWebApplicationCachePath(configDir.absolutePath());
    configDir.cdUp();
    QWebSettings::setMaximumPagesInCache(100);
    QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled,true);
    QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled,true);
    QWebSettings::globalSettings()->setAttribute(QWebSettings::LocalStorageEnabled,true);
    cookieJar = new CookieJar;
    webView->page()->networkAccessManager()->setCookieJar(cookieJar);
    cookieJar->load();
    configDir.cd("LocalStorage");
    webView->page()->settings()->setLocalStoragePath(configDir.absolutePath());
    webView->page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled,true);
    configDir.cdUp();

    QTimer *refreshTimer = new QTimer();
    refreshTimer->setInterval(5000);
    connect(refreshTimer,SIGNAL(timeout()),this,SLOT(getNewStatus()));
    refreshTimer->start();
    fullscreen = false;
    loadApplicationState();
}
开发者ID:spthaolt,项目名称:facebook,代码行数:93,代码来源:FacebookWidget.cpp

示例13: change

void addlens::change()
{
    if(dPrevAConst_1!=ui->AVal_1->text().toDouble())
    {
        if(ui->AVal_1->text().toDouble()>=115 && ui->AVal_1->text().toDouble()<=128)
        {
            double temp=ui->AVal_1->text().toDouble();

            ui->AVal_1->setText(QString::number(temp,'f',2));

           /* ui->A0val->setText(QString::number( (0.62467 *(ui->AVal_1->text().toDouble()) - 72.434),'f',2));

            ui->Acdval->setText(QString::number(((ui->AVal_1->text().toDouble())*0.5663-62.005)/0.9704,'f',2));

            ui->Sfval->setText(QString::number(0.9704 *ui->Acdval->text().toDouble() - 3.595,'f',2));*/


        }
        else
        {
            ui->AVal_1->setText(QString::number(dPrevAConst_1,'f',2));

            p=new prompta("AConst should be between 115 and 128",this);

            p->move(200,200);

            p->show();

            QTimer *msgBoxCloseTimer = new QTimer(this);

            msgBoxCloseTimer->setInterval(3000);

            msgBoxCloseTimer->setSingleShot(true);

            connect(msgBoxCloseTimer, SIGNAL(timeout()), p, SLOT(reject())); // or accept()

            msgBoxCloseTimer->start();

            p->exec();

        }

    }
    else if(dPrevAConst_2!=ui->AVal_2->text().toDouble())
    {
        if(ui->AVal_2->text().toDouble()>=115 && ui->AVal_2->text().toDouble()<=128)
        {
            double temp=ui->AVal_2->text().toDouble();

            ui->AVal_2->setText(QString::number(temp,'f',2));

            ui->A0val->setText(QString::number( (0.62467 *(ui->AVal_2->text().toDouble()) - 72.434),'f',2));

            ui->Acdval->setText(QString::number(((ui->AVal_2->text().toDouble())*0.5663-62.005)/0.9704,'f',2));

            ui->Sfval->setText(QString::number(0.9704 *ui->Acdval->text().toDouble() - 3.595,'f',2));


        }
        else
        {
            ui->AVal_2->setText(QString::number(dPrevAConst_2,'f',2));

            p=new prompta("AConst out of range",this);

            p->move(200,200);

            p->show();

            QTimer *msgBoxCloseTimer = new QTimer(this);

            msgBoxCloseTimer->setInterval(3000);

            msgBoxCloseTimer->setSingleShot(true);

            connect(msgBoxCloseTimer, SIGNAL(timeout()), p, SLOT(reject())); // or accept()

            msgBoxCloseTimer->start();

            p->exec();

        }

    }
    else if(dPrevAcd!=ui->Acdval->text().toDouble())
    {
        if(ui->Acdval->text().toDouble()>=3 && ui->Acdval->text().toDouble()<=11)
         {
             double temp=ui->Acdval->text().toDouble();

             ui->Acdval->setText(QString::number(temp,'f',2));

             ui->AVal_2->setText(QString::number((ui->Acdval->text().toDouble()*0.9704+62.005)/0.5663,'f',2));

             ui->Sfval->setText(QString::number(0.9704 *ui->Acdval->text().toDouble() - 3.595,'f',2));

             ui->A0val->setText(QString::number( (0.62467 *(ui->AVal_2->text().toDouble()) - 72.434),'f',2));


         }
//.........这里部分代码省略.........
开发者ID:AdityanJothi,项目名称:ASCAN,代码行数:101,代码来源:addlens.cpp

示例14: StartAnalysis

void BoatAnalysisDlg::StartAnalysis()
{
	//
	// Method applied from v6.00 onwards
	// 
	// First case :
	// If the analysis is for a wing and not a plane, the full 3D panel method is applied
	// and the wing is modelled as a thick surface
	// The method is strictly the one described in NASA TN 4023
	// The boundary condition is of the Dirichlet type, which has proved more convincing 
	// than the Neumann BC for full 3D panel methods
	//
	// Second case :
	// If the analysis is for a plane, the full 3D method is not applicable since the 
	// junctions between wing and body, or between fin and elevator, cannot be adequately 
	// represented as closed surfaces. This would require a 3D CAD programe. 
	// Therefore, in this case, the wings are modelled as thin surfaces.
	// Trial tests using the method of NASA TN 4023 have not been conclusive. With a uniform doublet
	// distribution and a boundary condition applied at the panel's centroid, the results 
	// are less convincing than with VLM.
	// Therefore in this case, the VLM1 method is applied to the thin surfaces, and the 3D-panel method 
	// is applied to the body.
	// Last consideration : since the potential of a straight vortex line requires a lot of computations, 
	// the Neumann type BC is applied to the body panels, rather than the Dirichlet type BC
	//
//	MainFrame *pMainFrame = (MainFrame*)s_pMainFrame;
	qApp->processEvents();

	if(!m_pBoatPolar) return;

	QString strong;
	m_pctrlCancel->setText(tr("Cancel"));
	m_bIsFinished = false;


	if(m_pBoatPolar->m_bVLM1) strong = tr("Launching VLM1 Analysis....")+"\n";
	else                      strong = tr("Launching VLM2 Analysis....")+"\n";

	AddString(strong);


	if(m_pBoat->m_poaHull.size())
	{
		if(m_pBoatPolar->m_bDirichlet) strong = tr("Using Dirichlet boundary conditions for thick bodies")+"\n";
		else                           strong = tr("Using Neumann boundary conditions for thick bodies")+"\n";
		AddString(strong);
		AddString("\n");
	}


	strong = tr("Type 1 - Fixed speed polar");
	AddString(strong);
	m_bCancel = false;

	QTimer *pTimer = new QTimer;
	connect(pTimer, SIGNAL(timeout()), this, SLOT(OnProgress()));
	pTimer->setInterval(100);
	pTimer->start();

	qApp->processEvents();

	UnitLoop();


	if (!m_bCancel && !m_bWarning) strong = "\n"+tr("Panel Analysis completed successfully")+"\n";
	else if (m_bWarning)           strong = "\n"+tr("Panel Analysis completed ... Errors encountered")+"\n";
	AddString(strong);
	pTimer->stop();

//	if(m_pBoatPolar && (m_pBoatPolar->m_Type==STABILITYPOLAR || m_pBoatPolar->m_bTiltedGeom || m_pBoatPolar->m_bWakeRollUp))
	{
		//restore the panels and nodes;
		memcpy(s_pPanel, s_pMemPanel, m_MatSize * sizeof(CPanel));
		memcpy(s_pNode,  s_pMemNode,  m_nNodes  * sizeof(CVector));
		memcpy(s_pWakePanel, s_pRefWakePanel, m_WakeSize * sizeof(CPanel));
		memcpy(s_pWakeNode,  s_pRefWakeNode,  m_nWakeNodes * sizeof(CVector));
	}

	m_bIsFinished = true;
	m_pctrlCancel->setText(tr("Close"));
}
开发者ID:kolzar,项目名称:sail7,代码行数:81,代码来源:BoatAnalysisDlg.cpp

示例15: pathToAgentOption

Window::Window()
{
    QCommandLineParser parser;
    QCommandLineOption pathToAgentOption("p", "Path to sync agent", "agentPath");
    parser.addOption(pathToAgentOption);
    QCommandLineOption skipAgentStartOption("s", "Do not try to start agent on start up", "skipAgentStart");
    parser.addOption(skipAgentStartOption);
    QCommandLineOption dumbTestOption("test", "Super simple start/stop test.");
    parser.addOption(dumbTestOption);
    parser.process(*qApp);
    bool startAgent = true;
    if(parser.isSet(skipAgentStartOption) && parser.value(skipAgentStartOption) == "true"){
        startAgent = false;
    }
    cmdHelper = new CmdHelper(this, (parser.isSet(pathToAgentOption))?parser.value(pathToAgentOption):"");
    if(parser.isSet(dumbTestOption)){
        QTimer *t = new QTimer(this);
        connect(t, SIGNAL(timeout()), qApp, SLOT(quit()));
        t->setInterval(5000);
        t->setSingleShot(true);
        t->start();
        qDebug()<<"Dumb test, will exit in 5 seconds...";
    }
    else{
        if(startAgent){
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX)
            cmdHelper->launchAgentProcess();
#elif defined(Q_OS_MAC)
            qDebug()<<"Starting agent via launchctl command.";
            cmdHelper->launchAgentMac();
#endif

        }

        if(CHECK_FOR_UPDATE){
            updateDialog = new UpdateDialog(this);
            updatePinger = new PydioUpdatePinger(this);
            connect(updatePinger, SIGNAL(updateFound(QString,QString,QString,QString)),
                    updateDialog, SLOT(proposeDownload(QString,QString,QString,QString)));
            updatePinger->lookForUpdate();
        }

        QString dataDir = CmdHelper::getAppDataDir() +'/'+ PORT_CONFIG_FILE_NAME;
        portConfigurer = new PortConfigurer(dataDir);
        pollTimer = new QTimer(this);
        pollTimer->setInterval(POLL_INTERVAL);
        pollTimer->setSingleShot(true);

        httpManager = new HTTPManager(this);
        this->createTrayIcon();
        tray->show();

        aboutDialog = new AboutDialog(this);

        connect(pollTimer, SIGNAL(timeout()), httpManager, SLOT(poll()));
        connect(httpManager, SIGNAL(requestFinished()), pollTimer, SLOT(start()));
        connect(httpManager, SIGNAL(newJob(Job*)), tray, SLOT(onNewJob(Job*)));
        connect(httpManager, SIGNAL(jobUpdated(QString)), tray, SLOT(onJobUpdate(QString)));
        connect(httpManager, SIGNAL(jobDeleted(QString)), tray, SLOT(onJobDeleted(QString)));
        connect(httpManager, SIGNAL(connectionProblem()), tray, SLOT(connectionLost()));
        connect(httpManager, SIGNAL(agentReached()), this, SLOT(agentReached()));
        connect(httpManager, SIGNAL(noActiveJobsAtLaunch()), this, SLOT(show()));
        connect(httpManager, SIGNAL(jobsCleared()), tray, SLOT(jobsCleared()));
        connect(httpManager, SIGNAL(webUI404()), this, SLOT(notFoundFromPython()));
        connect(httpManager, SIGNAL(noInternetConnection()), tray, SLOT(noInternetConnection()));
        connect(httpManager, SIGNAL(internetConnectionOk()), tray, SLOT(internetConnectionOk()));
        connect(httpManager, SIGNAL(connectionProblem()), this, SLOT(connectionLost()));
        connect(httpManager, SIGNAL(jobNotifyMessage(QString,QString,QString)), tray, SLOT(notificationReceived(QString,QString,QString)));

        connect(tray, SIGNAL(about()), this, SLOT(about()));
        connect(tray, SIGNAL(pauseSync()), httpManager, SLOT(pauseSync()));
        connect(tray, SIGNAL(resumeSync()), httpManager, SLOT(resumeSync()));
        connect(tray, SIGNAL(quit()), this, SLOT(cleanQuit()));
        connect(tray, SIGNAL(launchAgentSignal()), cmdHelper, SLOT(launchAgentProcess()));
//        connect(cmdHelper, SIGNAL(winAgentLaunched()), this, SLOT(show()));

        settingsWebView = new QWebView();

        jsDialog = new JSEventHandler(this);

        portConfigurer->updatePorts();
        httpManager->setUrl(AGENT_SERVER_URL + portConfigurer->port(), portConfigurer->username(), portConfigurer->password());
        httpManager->poll();

        //this->setWindowFlags(Qt::Tool);
        setWindowTitle(PYDIO_DATA_DIR);
        setWindowIcon(QIcon(":/images/PydioSync-Systray-Mac.png"));
    }
}
开发者ID:7omate,项目名称:pydio-sync-ui,代码行数:89,代码来源:window.cpp


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