• 大小: 3.09MB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2023-09-20
  • 语言: 其他
  • 标签: QT  C++  

资源简介

自己在实习期间用QT写的超市管理系统,这是当时公司已经做过的项目,让我们拿来练手,最后答辩验收。我写的系统界面我觉得还是很漂亮的,并且功能齐全。

资源截图

代码片段和文件信息

#include “basewindow.h“
#include 
#include 
#include 
#include 
#include yleOption>

baseWindow::baseWindow(QWidget *parent)
: QDialog(parent)
{
// framelessWindowHint属性设置窗口去除边框;
// WindowMinimizeButtonHint 属性设置在窗口最小化时,点击任务栏窗口可以显示出原窗口;
//Qt::WindowFlags flag = this->windowFlags();
this->setWindowFlags(Qt::framelessWindowHint | Qt::WindowMinimizeButtonHint);
// 设置窗口背景透明;
setAttribute(Qt::WA_TranslucentBackground);
// 关闭窗口时释放资源;
//setAttribute(Qt::WA_DeleteOnClose);
// 初始化标题栏;
inittitleBar();
}

baseWindow::~baseWindow()
{

}

void baseWindow::inittitleBar()
{
m_titleBar = new MytitleBar(this);
m_titleBar->move(0 0);

connect(m_titleBar SIGNAL(signalButtonMinClicked()) this SLOT(onButtonMinClicked()));
connect(m_titleBar SIGNAL(signalButtonRestoreClicked()) this SLOT(onButtonRestoreClicked()));
connect(m_titleBar SIGNAL(signalButtonMaxClicked()) this SLOT(onButtonMaxClicked()));
connect(m_titleBar SIGNAL(signalButtonCloseClicked()) this SLOT(onButtonCloseClicked()));

}

void baseWindow::paintEvent(QPaintEvent* event)
{
Q_UNUSED(event);
QstyleOption opt;
opt.init(this);
QPainter painter(this);
style()->drawPrimitive(Qstyle::PE_Widget &opt &painter this);

//设置背景色;

QPainterPath pathBack;
pathBack.setFillRule(Qt::WindingFill);
pathBack.addRoundedRect(QRect(0 0 this->width() this->height()) 3 3);
painter.setRenderHint(QPainter::SmoothPixmapTransform true);
painter.fillPath(pathBack QBrush(QColor(236 241 245)));

// return QWidget::paintEvent(event);
}

void baseWindow::loadstyleSheet(const QString &sheetName)
{
QFile file(sheetName);
file.open(QFile::ReadOnly);
if (file.isOpen())
{
QString styleSheet = this->styleSheet();
styleSheet += QLatin1String(file.readAll());
this->setstyleSheet(styleSheet);
}
}

void baseWindow::onButtonMinClicked()
{
if (Qt::Tool == (windowFlags() & Qt::Tool))
{
hide();    //设置了Qt::Tool 如果调用showMinimized()则窗口就销毁了???
}
else
{
showMinimized();
}
}

void baseWindow::onButtonRestoreClicked()
{
QPoint windowPos;
QSize windowSize;
m_titleBar->getRestoreInfo(windowPos windowSize);
this->setGeometry(QRect(windowPos windowSize));
}

void baseWindow::onButtonMaxClicked()
{
m_titleBar->saveRestoreInfo(this->pos() QSize(this->width() this->height()));
QRect desktopRect = QApplication::desktop()->availableGeometry();
QRect FactRect = QRect(desktopRect.x() - 3 desktopRect.y() - 3 desktopRect.width() + 6 desktopRect.height() + 6);
setGeometry(FactRect);
}

void baseWindow::onButtonCloseClicked()
{
// 注意 !!!;
// 如果设置了Qt::Tool 且当前窗口为主窗口调用close()方法只是关闭了当前窗口,并没有结束整个程序进程;
// 如果只有一个窗口情况下需要调用qApp->quit();来结束进程;
// 如果设置了Qt::Tool的窗口是子窗口,则只需要调用close()方法关闭即可;
//  if (Qt::Tool == (windowFlags() & Qt::Tool))
//  {
//  qApp->quit();
//  }
//  else
{
close();
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       3145  2017-06-27 11:41  SuperMarketClient\basewindow.cpp

     文件        543  2016-12-21 21:05  SuperMarketClient\basewindow.h

     文件       2856  2017-06-28 14:24  SuperMarketClient\detailsales.cpp

     文件        608  2017-06-28 14:22  SuperMarketClient\detailsales.h

     文件        413  2017-06-28 13:41  SuperMarketClient\detailsales.ui

     文件       4060  2016-12-22 18:46  SuperMarketClient\GeneratedFiles\Debug\moc_basewindow.cpp

     文件       2734  2016-12-22 18:46  SuperMarketClient\GeneratedFiles\Debug\moc_loginwindow.cpp

     文件       6756  2016-12-22 18:46  SuperMarketClient\GeneratedFiles\Debug\moc_mytitlebar.cpp

     文件    6556315  2016-12-22 18:46  SuperMarketClient\GeneratedFiles\qrc_loginwindow.cpp

     文件       8065  2016-12-22 18:46  SuperMarketClient\GeneratedFiles\ui_loginwindow.h

     文件       9093  2017-06-27 09:23  SuperMarketClient\HeadImage.png

     文件       3805  2017-06-28 10:45  SuperMarketClient\images\headimage.png

     文件       4717  2017-06-28 10:45  SuperMarketClient\images\headImage1.png

     文件       9830  2017-06-28 10:37  SuperMarketClient\images\PersonnelManage.png

     文件       4529  2017-06-28 10:34  SuperMarketClient\images\PurchaseManage.png

     文件       4928  2017-06-28 10:35  SuperMarketClient\images\sales.png

     文件       7019  2017-06-28 10:38  SuperMarketClient\images\statistics.png

     文件       3481  2017-06-28 10:36  SuperMarketClient\images\StockManage.png

     文件      10862  2017-06-28 10:39  SuperMarketClient\images\SystemManage.png

     文件       2330  2017-06-30 14:33  SuperMarketClient\jsontools.cpp

     文件        626  2017-06-30 10:47  SuperMarketClient\jsontools.h

     文件       1188  2017-06-30 10:21  SuperMarketClient\login.pro

     文件      18616  2017-07-01 19:17  SuperMarketClient\login.pro.user

     文件      22282  2017-07-01 13:46  SuperMarketClient\login.pro.user.8d21195

     文件       8446  2017-06-30 13:30  SuperMarketClient\loginwindow.cpp

     文件       1234  2017-06-29 10:47  SuperMarketClient\loginwindow.h

     文件       1288  2017-06-27 10:22  SuperMarketClient\loginwindow.qrc

     文件       7528  2017-06-27 10:53  SuperMarketClient\loginwindow.ui

     文件      14722  2016-12-22 18:47  SuperMarketClient\LoginWindow.vcxproj

     文件       3631  2016-12-22 18:47  SuperMarketClient\LoginWindow.vcxproj.filters

............此处省略75个文件信息

评论

共有 条评论