QT programming enables Windows to run Windows+r

Source: Internet
Author: User

Running programs that are implemented using WINDOWS+R under Windows

Widget.h

#ifndef Widget_h

#define Widget_h
#include <QWidget>
#include <QProcess>
Namespace Ui {
Class Widget;
}

Class Widget:public Qwidget
{
Q_object

Public
Explicit Widget (Qwidget *parent = 0);
~widget ();

Private Slots:
void on_submitbutton_clicked ();


Private
Ui::widget *ui;
};

#endif//Widget_h


Main.cpp

#include <qtgui/qapplication>
#include "widget.h"
int main (int argc, Char *argv[])
{
    qapplication A (argc, argv);
    Widgets W;
    w.show ();
    
    return a.exec ();
}

#include "Widget.h"
#include "Ui_widget.h"
#include <QWidget>
#include <QProcess>
Widget::widget (Qwidget *parent):
Qwidget (parent),
UI (New Ui::widget)
{
UI->SETUPUI (this);
This->setmaximumsize (391,171);
This->setminimumsize (391,171);
Qobject::connect (Ui->cmdlineedit,signal (returnpressed ()), This,slot (on_submitbutton_clicked ()));
}
Widget::~widget ()
{
Delete UI;
}
void Widget::on_submitbutton_clicked ()
{
Qprocess *process = new Qprocess;
QString Startprogram=ui->cmdlineedit->text ();
Process->start (Startprogram.trimmed ());
Ui->cmdlineedit->clear ();
This->close ();
}

Widget.cpp

QT programming enables Windows to run Windows+r

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.