Error QT source program

xiaoxiao2021-03-06  68

Select.h # ifndef SELECT_H # Define SELECT_H

#include #include #include #include #include #include #include # Include #include #include #include #include

Class Form1: Public Qwidget {

public: Form1 (QWidget * parent = 0, const char * name = 0); QLabel * pixmapLabel; QLabel * textLabel; QPushButton * pushButton2; QPushButton * pushButton3; QPushButton * pushButton1; QListView * mw; private: QPixmap image0; public slots: Void getName (QlistViewItem *);

# endifselect.cpp (I am also putting main) #include

#include #include #include #include #include #include #include # Include #include #include #include #include #include static const unsigned char image0_data [] = { 0x89, 0x50, 0x4e, 0x47, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x08, 0x06, 0x00, 0x00, 0x00, 0xaa, 0x69, 0x71, 0x1, 0x99, 0x00, 0x1e, 0x99, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0x94, 0x9b, 0x79, 0x94, 0x5c,}; Form1: : Form1 (QWidget * parent, const char * name): QWidget (parent, name) {QImage img; img.loadFromData (image0_data, sizeof (image0_data), "PNG"); image0 = img; pixmapLabel = new QLabel (this, "Pixmaplabel1"); Pixmaplabel-> setGeometry (QRECT (5, 5, 50, 50)); Pixmaplabel-> setpixmap (image0); pixmaplabel-> setscaledContents (TRUE);

TextLabel = new Qlabel (this "TextLabel"); TextLabel-> setGeometry (QRECT (58, 8, 200, 50)); TextLabel-> Settext (TR ("Learning Garden))); TextLabel-> setFont (QFont "Song Ti", 26, QFont :: bold); pushbutton1 = new qpushbutton (this, "pushbutton1"); pushbutton1-> setGeometry (qrect (230, 50, 91, 31)); pushbutton1-> settext (TR (TR) "Open")); pushbutton2 = new qpushbutton (this, "pushbutton2"); pushbutton2-> setGeometry (qrect (230, 120, 91, 31); pushbutton2-> settext (TR ("Add File"); Pushbutton3 = New Qpushbutton (this, "pushbutton3"); pushbutton3-> setGeometry (qRECT (230, 190, 91, 31); pushbutton3-> settext (Tr ("Remove File"); QlistView * MW = New QlistView (this , "Form1"); MW-> setGeometry (qrect (0, 60, 211, 250)); MW-> AddColumn (TR ("directory")); MW-> settreestepsize (20);

QDir D; D.SetPath ("/ Home / Pangdae / Study /"); D.SetFilter (0x002); const QfileInfolist * roots = D.EnTryInfolist (); QPTRListIterator i (* roots); QfileInfo * fi; While ((fi = * i)) { i; QListViewItem * root = new qlistviewItem (MW, FI-> filename ()); if (roots-> count () <= 1) root-> setopen (true) Connect (MW, Signal *), this, slot (GetName (QlistViewItem *));} void form1 :: getname (QListViewItem * Item) {qstring name; name = item-> text (0 ); Cout << name << endl;}

INT Main (int Argc, char * argv []) {qapplication app (argc, argv); app.setfont (QFont ("Song Ti", 12)); app.setdefaultcodec (QTextcodec :: CodecForname ("zh_cn.gb2312" ));

转载请注明原文地址:https://www.9cbs.com/read-109597.html

New Post(0)