⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mp3.cpp

📁 mp3 jie mian linux qt
💻 CPP
字号:
#include <qapplication.h>#include <qwidget.h>#include <qpushbutton.h>	//按钮#include <qfont.h>#include <qlabel.h>		//标签#include <qdatetime.h>  	//当前日期与时间#include <qslider.h>		//滑动框#include <qlcdnumber.h>		//显示音量大小#include <qmainwindow.h>//#include <qscrollview.h>class MyMainWindow : public QWidget{			public:		MyMainWindow(); 			 			private:		QPushButton *b1;      	//播放		QPushButton *b2;      	//上一首歌		QPushButton *b3;      	//下一首歌				QPushButton *b4; 	//关闭 		QPushButton *b5;	//暂停		QLabel *label1;		//显示日期时间		QLabel *label2;		//音量				QLCDNumber *lcd;				QSlider *slider;	//音量滑动框		};/*class Mp3Player : public QMainWindow {		Q_OBJECT	public:		Mp3Player();	public:		void doPlay1();		void doPlay2();
		void doPlay3();};void Mp3Player ::doPlay1(){	//Q......  ::play("mp3s/1.mp3");}
void Mp3Player ::doPlay2()
{
	

}
void Mp3Player ::doPlay3()
{



}

*/MyMainWindow :: MyMainWindow(){		setGeometry(1,1,500,450);	//四个按钮 播放/暂停	b1=new QPushButton("Play",this);	b1->setGeometry(130,250,100,50);	b1->setFont( QFont ("Times",18,QFont::Bold ) );  	//connect(b1,SIGNAL( clicked() ),this,SLOT( doPlay2() );		b2=new QPushButton("Next",this);	b2->setGeometry(380,250,100,50);	b2->setFont( QFont ("Times",18,QFont::Bold ) );  	//connect(b2,SIGNAL( clicked() ),this,SLOT( doPlayer3() );		b3=new QPushButton("Last",this);	b3->setGeometry(0,250,100,50);	b3->setFont( QFont ("Times",18,QFont::Bold ) );  	//connect(b3,SIGNAL( clicked() ),this,SLOT( doPlayer1() );		b4=new QPushButton("close",this);	b4->setGeometry(400,0,100,50);	b4->setFont( QFont ("Times",18,QFont::Bold ) ); 	connect(b4, SIGNAL( clicked() ),qApp,SLOT( quit() ) );	b5=new QPushButton("Stop",this);	b5->setGeometry(250,250,100,50);	b5->setFont( QFont ("Times",18,QFont::Bold ) );  	//connect(b5,SIGNAL( clicked() ),this,SLOT( );			//显示时间与日期。。。。。	//Create a QDateTime object;	QDateTime datetime;		//Set the date the currnt date	datetime.setDate( QDate::currentDate() );		//Set the time to the current time	datetime.setTime( QTime::currentTime() );			//use the QDateTime::toString() function to make	//a string out of the date and time and show it	//in a QLabel object		label1=new QLabel( datetime.toString(),this );	label1->setGeometry(0,0,300,50);	label1->setAlignment(AlignCenter);	label1->setFont( QFont ("Times",18,QFont::Bold ) );	                                                                                		//音量	label2=new QLabel(this);	label2->setGeometry(50,350,100,50);	label2->setText("volume");	label2->setFont( QFont ("Times",18,QFont::Bold ) );	//滑块调节音量,并显示具体大小	//第一个参数设置滑动框的最小值,第2设置最大值,第3设置当点击	//左边或右边的调节标尺时滑块跳动的距离。第四设置滑动框的默认值	//第5设置滑块方向(水平OR垂直),第6为指向滑块框父部件的指针	slider=new QSlider( 0,20,1,10,Horizontal,this );		slider->setGeometry(200,350,300,50);	//QSlider::setTickmarks()设置滑动框下面所显示的跳动标记。它们使	//用户能够更加清晰地看到滑动框的当前值	slider->setTickmarks(QSlider::Below);	lcd=new QLCDNumber(2,this);	lcd->setGeometry(300,400,100,50);		connect(slider,SIGNAL( valueChanged(int) ),		lcd,SLOT( display(int) ) );	//connect(slider,SIGNAL( ),  ,SLOT( ) );   //与歌曲挂钩}int  main(int argc, char **argv){	//Create an QApplication object.	QApplication app(argc,argv);	MyMainWindow w;  //myclass w	app.setMainWidget(&w);	w.show();	return app.exec();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -