Skip to content

Commit e94246d

Browse files
author
YuTinCH
committed
1 parent 54da281 commit e94246d

File tree

6 files changed

+587
-0
lines changed

6 files changed

+587
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#-------------------------------------------------
2+
#
3+
# Project created by QtCreator 2013-11-03T22:12:55
4+
#
5+
#-------------------------------------------------
6+
7+
QT += core gui
8+
9+
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10+
11+
TARGET = firstqtproject
12+
TEMPLATE = app
13+
14+
15+
SOURCES += main.cpp\
16+
mainwindow.cpp
17+
18+
HEADERS += mainwindow.h
19+
20+
FORMS += mainwindow.ui

Qt解決亂碼問題/firstqtproject/firstqtproject.pro.user

+425
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include "mainwindow.h"
2+
#include <QApplication>
3+
4+
5+
int main(int argc, char *argv[])
6+
{
7+
8+
QApplication a(argc, argv);
9+
MainWindow w;
10+
w.show();
11+
12+
return a.exec();
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include "mainwindow.h"
2+
#include "ui_mainwindow.h"
3+
#include <QTextCodec>
4+
5+
MainWindow::MainWindow(QWidget *parent) :
6+
QMainWindow(parent),
7+
ui(new Ui::MainWindow)
8+
{
9+
ui->setupUi(this);
10+
ui->comboBox->setEnabled(false);
11+
QStringList cityname;
12+
cityname<<QStringLiteral("基隆市")<<QStringLiteral("台北市")<<QStringLiteral("新北市");
13+
//cityname.
14+
ui->comboBox->addItems(cityname);
15+
16+
}
17+
MainWindow::~MainWindow()
18+
{
19+
delete ui;
20+
}
21+
void MainWindow::on_checkBox_clicked(bool checked)
22+
{
23+
if(checked) ui->comboBox->setEnabled(true);
24+
else ui->comboBox->setEnabled(false);
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef MAINWINDOW_H
2+
#define MAINWINDOW_H
3+
4+
#include <QMainWindow>
5+
#include <QStringList>
6+
7+
namespace Ui {
8+
class MainWindow;
9+
}
10+
11+
class MainWindow : public QMainWindow
12+
{
13+
Q_OBJECT
14+
15+
public:
16+
explicit MainWindow(QWidget *parent = 0);
17+
~MainWindow();
18+
19+
private slots:
20+
void on_checkBox_clicked(bool checked);
21+
22+
private:
23+
Ui::MainWindow *ui;
24+
};
25+
26+
#endif // MAINWINDOW_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>MainWindow</class>
4+
<widget class="QMainWindow" name="MainWindow">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>368</width>
10+
<height>91</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>MainWindow</string>
15+
</property>
16+
<widget class="QWidget" name="centralWidget">
17+
<layout class="QGridLayout" name="gridLayout">
18+
<item row="0" column="0">
19+
<widget class="QCheckBox" name="checkBox">
20+
<property name="sizePolicy">
21+
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
22+
<horstretch>0</horstretch>
23+
<verstretch>0</verstretch>
24+
</sizepolicy>
25+
</property>
26+
<property name="minimumSize">
27+
<size>
28+
<width>120</width>
29+
<height>0</height>
30+
</size>
31+
</property>
32+
<property name="maximumSize">
33+
<size>
34+
<width>120</width>
35+
<height>16777215</height>
36+
</size>
37+
</property>
38+
<property name="text">
39+
<string>選擇台灣城市</string>
40+
</property>
41+
</widget>
42+
</item>
43+
<item row="0" column="1">
44+
<widget class="QComboBox" name="comboBox">
45+
<property name="sizePolicy">
46+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
47+
<horstretch>0</horstretch>
48+
<verstretch>0</verstretch>
49+
</sizepolicy>
50+
</property>
51+
</widget>
52+
</item>
53+
</layout>
54+
</widget>
55+
<widget class="QMenuBar" name="menuBar">
56+
<property name="geometry">
57+
<rect>
58+
<x>0</x>
59+
<y>0</y>
60+
<width>368</width>
61+
<height>21</height>
62+
</rect>
63+
</property>
64+
</widget>
65+
<widget class="QToolBar" name="mainToolBar">
66+
<attribute name="toolBarArea">
67+
<enum>TopToolBarArea</enum>
68+
</attribute>
69+
<attribute name="toolBarBreak">
70+
<bool>false</bool>
71+
</attribute>
72+
</widget>
73+
<widget class="QStatusBar" name="statusBar"/>
74+
</widget>
75+
<layoutdefault spacing="6" margin="11"/>
76+
<resources/>
77+
<connections/>
78+
</ui>

0 commit comments

Comments
 (0)