1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

update vegetablesprice to use mainwindow

This commit is contained in:
tianduanrui 2017-10-29 15:51:13 +08:00
parent 061aeaef06
commit 89e64a73db
9 changed files with 98 additions and 87 deletions

View File

@ -16,6 +16,7 @@ SUBDIRS += examples/QQtInstaller
#need QQt installed to Qt library or
#need QQt installed to sdk
SUBDIRS += examples/qqtframe3
SUBDIRS += examples/VegeTablesPrice
#need vlcQt libvlc library
#SUBDIRS += examples/qqtliveplayer
@ -35,4 +36,3 @@ SUBDIRS += examples/qqtframe3
#need QtSoap - WebSupport
#SUBDIRS += examples/easter
#SUBDIRS += examples/soapQQtOnline
#SUBDIRS += examples/VegeTablesPrice

View File

@ -73,11 +73,11 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
main.cpp \
dialog.cpp
mainwindow.cpp
HEADERS += \
dialog.h
mainwindow.h
FORMS += \
dialog.ui
mainwindow.ui

View File

@ -1,27 +0,0 @@
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
#include <QListWidget>
namespace Ui
{
class Dialog;
}
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget* parent = 0);
~Dialog();
private slots:
void currentItemChanged(QListWidgetItem*, QListWidgetItem*);
private:
Ui::Dialog* ui;
};
#endif // DIALOG_H

View File

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>692</width>
<height>278</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListWidget" name="lw">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="web" native="true"/>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -1,10 +1,10 @@
#include "dialog.h"
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
Dialog w;
MainWindow w;
w.show();
return a.exec();

View File

@ -1,17 +1,14 @@
#include "dialog.h"
#include "ui_dialog.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "QtWebView"
#include "QDebug"
Dialog::Dialog(QWidget* parent) :
QDialog(parent),
ui(new Ui::Dialog)
MainWindow::MainWindow(QWidget* parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QtWebView::initialize();
QStringList vl;
vl << "西葫芦";
vl << "土豆";
@ -47,15 +44,17 @@ Dialog::Dialog(QWidget* parent) :
ui->lw->setCurrentRow(0);
}
Dialog::~Dialog()
MainWindow::~MainWindow()
{
delete ui;
}
void Dialog::currentItemChanged(QListWidgetItem* cur, QListWidgetItem* prev)
void MainWindow::currentItemChanged(QListWidgetItem* cur, QListWidgetItem* prev)
{
qDebug() << cur << prev;
if (!cur)
return;
QString url = QString("http://www.baidu.com/s?wd=%1%2").arg(cur->text()).arg("价格");
//ui->web->load(QUrl(url));
}

View File

@ -0,0 +1,26 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QListWidget>
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget* parent = 0);
~MainWindow();
private slots:
void currentItemChanged(QListWidgetItem*, QListWidgetItem*);
private:
Ui::MainWindow* ui;
};
#endif // MAINWINDOW_H

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>889</width>
<height>444</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QListWidget" name="lw">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="tableWidget"/>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>889</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -5,6 +5,7 @@
#-------------------------------------------------
#include QQt's header (add QQt header to includepath)
include(../../src/qqt_header.pri)
include(../../src/qqt_version.pri)
#CONFIG += BUILD_SRC
contains (CONFIG, BUILD_SRC) {
@ -12,7 +13,7 @@ contains (CONFIG, BUILD_SRC) {
#include(../../src/qqt.pri)
} else {
#if you want to link QQt library
include(../qqt_library.pri)
include(../qqtframe2/qqt_library.pri)
}
QT += core gui webkitwidgets