QT -狗狗管理工具

news2025/2/26 6:01:41

QT -狗狗管理工具

  • 一、演示效果
  • 二、UML
  • 三、关键代码
  • 四、程序链接


一、演示效果

请添加图片描述

请添加图片描述

二、UML

请添加图片描述

三、关键代码

#include <QFrame>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
#include <QSizePolicy>
#include <QDialog>
#include <QDialogButtonBox>


#include "DogVisitorCard.h"
#include "DogVisitorInfoPanel.h"
#include "Dog/owner.h"
#include "./view/buttons/ButtonsWidget.h"

#include "breeds/breed.h"
#include "breeds/amstaff.h"
#include "breeds/bulldog.h"



QVBoxLayout* DogVisitorCard::getCard() const{
    return cardLayout;
}

void DogVisitorCard::visitBoarding(Boarding &boarding) {

    QHBoxLayout* hbox=new QHBoxLayout();

    dog=&boarding;

    hbox->addSpacing(30);

    //left image
    QHBoxLayout* img= new QHBoxLayout();
    QLabel* image= new QLabel();
    image->setPixmap(QPixmap(":/assets/icons8-dog-house-64.png"));
    image->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
    img->addWidget(image);
    hbox->addLayout(img);


    hbox->addSpacing(25);


    //Dog's info
    QVBoxLayout* info= new QVBoxLayout();
    hbox->addLayout(info);
    info->setAlignment(Qt::AlignCenter);



    //name
    QLabel* name= new QLabel("Name: "+ QString::fromStdString(boarding.getName()));
    info->addWidget(name);

    //date
    QLabel* date= new QLabel("Arrival date: "+ QString::fromStdString(boarding.getDate().toString()));
    info->addWidget(date);

    //Owner
    Owner* owner=boarding.getOwner();
    std::string OwnerName=owner->getName();
    std::string OwnerSurname=owner->getSurname();
    QLabel* ownerString= new QLabel("Owner: " + QString::fromStdString(OwnerName + " " + OwnerSurname));
    info->addWidget(ownerString);


    //Optional services
    QLabel* optionalService= new QLabel("Optional services: ");
    info->addWidget(optionalService);


    QHBoxLayout* srvc= new QHBoxLayout();
    info->addLayout(srvc);


    //Bath
    QLabel* bath= new QLabel();
    QLabel* bathString= new QLabel("Bath");
    bath->setAlignment(Qt::AlignRight|Qt::AlignCenter);

    if (boarding.didBath())
        bath->setPixmap(QPixmap(":/assets/icons8-done-48.png").scaled(10,10,Qt::KeepAspectRatio));
    else
        bath->setPixmap(QPixmap(":/assets/icons8-close-48.png").scaled(10,10,Qt::KeepAspectRatio));

    srvc->addWidget(bath);
    srvc->addWidget(bathString);


    //Diet
    QLabel* diet= new QLabel();
    QLabel* dietString= new QLabel("Diet");
    diet->setAlignment(Qt::AlignRight|Qt::AlignCenter);

    if (boarding.didDiet())
        diet->setPixmap(QPixmap(":/assets/icons8-done-48.png").scaled(10,10,Qt::KeepAspectRatio));
    else
        diet->setPixmap(QPixmap(":/assets/icons8-close-48.png").scaled(10,10,Qt::KeepAspectRatio));

    srvc->addWidget(diet);
    srvc->addWidget(dietString);


    //Trainings
    QLabel* trainings= new QLabel();
    QLabel* trainString= new QLabel("Trainings");
    trainings->setAlignment(Qt::AlignRight|Qt::AlignCenter);

    if (boarding.didTraining())
        trainings->setPixmap(QPixmap(":/assets/icons8-done-48.png").scaled(10,10,Qt::KeepAspectRatio));
    else
        trainings->setPixmap(QPixmap(":/assets/icons8-close-48.png").scaled(10,10,Qt::KeepAspectRatio));

    srvc->addWidget(trainings);
    srvc->addWidget(trainString);


    //Walks
    QLabel* walks= new QLabel();
    QLabel* walksString= new QLabel("Walks");
    walks->setAlignment(Qt::AlignRight|Qt::AlignCenter);

    if (boarding.didWalking())
        walks->setPixmap(QPixmap(":/assets/icons8-done-48.png").scaled(10,10,Qt::KeepAspectRatio));
    else
        walks->setPixmap(QPixmap(":/assets/icons8-close-48.png").scaled(10,10,Qt::KeepAspectRatio));

    srvc->addWidget(walks);
    srvc->addWidget(walksString);

    hbox->addStretch();
    hbox->addStretch();



    hbox->addSpacing(25);


    //put all things togheter
    cardLayout= new QVBoxLayout();
    cardLayout->addLayout(hbox);


}



void DogVisitorCard::visitBreeding(Breeding &breeding) {

    QHBoxLayout* hbox=new QHBoxLayout();

    hbox->addSpacing(30);

    dog=&breeding;

    //left image
    QHBoxLayout* img= new QHBoxLayout();
    QLabel* image= new QLabel();

    Breed* bulldogPointer=breeding.getBreed();


    if(dynamic_cast<Bulldog*>(bulldogPointer))
        image->setPixmap(QPixmap(":/assets/icons8-french-bulldog-64.png"));
    else
        image->setPixmap(QPixmap(":/assets/icons8-dog-64.png"));


    image->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
    img->addWidget(image);
    hbox->addLayout(img);


    hbox->addSpacing(25);


    //Dog's info
    QVBoxLayout* info= new QVBoxLayout();
    hbox->addLayout(info);
    info->setAlignment(Qt::AlignCenter|Qt::AlignVCenter);


    //name
    QLabel* name= new QLabel("Name: "+ QString::fromStdString(breeding.getName()));
    info->addWidget(name);

    //date
    QLabel* date= new QLabel("Day of birth: "+ QString::fromStdString(breeding.getDate().toString()));
    info->addWidget(date);


    //Breed
    QLabel* breed= new QLabel("Breed: "+QString::fromStdString(breeding.getBreed()->toString()));
    info->addWidget(breed);


    //Optional services
    QLabel* options= new QLabel("Options: ");
    info->addWidget(options);


    QHBoxLayout* opt= new QHBoxLayout();
    info->addLayout(opt);


    //Vax
    QLabel* vax= new QLabel();
    QLabel* vaxString= new QLabel("Vaxxed");
    vax->setAlignment(Qt::AlignRight|Qt::AlignCenter);

    if (breeding.isVax())
        vax->setPixmap(QPixmap(":/assets/icons8-done-48.png").scaled(10,10,Qt::KeepAspectRatio));
    else
        vax->setPixmap(QPixmap(":/assets/icons8-close-48.png").scaled(10,10,Qt::KeepAspectRatio));

    opt->addWidget(vax);
    opt->addWidget(vaxString);


    //Purchasable
    QLabel* purch= new QLabel();
    QLabel* purchString= new QLabel("Purchasable");
    purch->setAlignment(Qt::AlignRight|Qt::AlignCenter);

    if (breeding.isPurchasable())
        purch->setPixmap(QPixmap(":/assets/icons8-done-48.png").scaled(10,10,Qt::KeepAspectRatio));
    else
        purch->setPixmap(QPixmap(":/assets/icons8-close-48.png").scaled(10,10,Qt::KeepAspectRatio));

    opt->addWidget(purch);
    opt->addWidget(purchString);


    //Booked
    QLabel* booked= new QLabel();
    QLabel* bookedString= new QLabel("Booked");
    booked->setAlignment(Qt::AlignRight|Qt::AlignCenter);

    if (breeding.isBooked())
        booked->setPixmap(QPixmap(":/assets/icons8-done-48.png").scaled(10,10,Qt::KeepAspectRatio));
    else
        booked->setPixmap(QPixmap(":/assets/icons8-close-48.png").scaled(10,10,Qt::KeepAspectRatio));

    opt->addWidget(booked);
    opt->addWidget(bookedString);

    hbox->addStretch();
    hbox->addStretch();


    hbox->addSpacing(25);


    //put all things togheter
    cardLayout= new QVBoxLayout();
    cardLayout->addLayout(hbox);


}

四、程序链接

https://download.csdn.net/download/u013083044/88739503

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1383020.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【深度学习每日小知识】Computer Vision 计算机视觉

计算机视觉是人工智能的一个领域&#xff0c;涉及算法和系统的开发&#xff0c;使计算机能够解释、理解和分析来自周围世界的视觉数据。这包括从静态图像到视频流甚至 3D 环境的一切。 使用对象检测和特征提取等方法&#xff0c;计算机视觉本质上需要从视觉输入中提取有用信息…

大模型微调及生态简单介绍

大模型 大模型生态OpenAI大模型生态&#xff1a; 全球开源大模型性能评估榜单中文语言模型——ChatGLM基于ChatGLM的多模态⼤模型 大模型微调LLM⼤语⾔模型 ⼀般训练过程为什么需要微调高效微调技术⽅法概述⾼效微调⽅法一&#xff1a;LoRA微调方法高效微调⽅法⼆&#xff1a;P…

linux 网络设置

查看linux基础的网络配置 命令 网关route -nip 地址ifconfig / ip aDNS 服务器cat /etc/resolv.conf主机名hostname路由route -n网络连接状态ss / netstat 一&#xff0c;ifconfig 查看网络接口信息 &#xff08;一&#xff09;ifconfig …

C++|68.虚析构函数

文章目录 虚析构函数诞生的背景问题若创造一个子类的对象&#xff0c;并使用一个父类的指针指向/管理它&#xff0c;结果会如何解决方案——虚析构函数 虚析构函数诞生的背景 Derived继承了Base&#xff0c;Derived本身自带析构函数&#xff0c;而由于继承了Base&#xff0c;De…

openssl3.2 - quic服务的运行

文章目录 openssl3.2 - quic服务的运行概述笔记运行openssl编译好的quic服务程序todo - 如果自己编译quic服务工程END openssl3.2 - quic服务的运行 概述 在看 官方 guide目录下的工程. 都是客户端程序, 其中有quic客户端, 需要运行quic服务才行. openssl编译好的目录中有编译…

【Python】数据可视化--基于TMDB_5000_Movie数据集

一、数据准备 tmdb_5000_movie数据集下载 二、数据预处理 观察数据集合情况 import pandas as pd import ast import warnings warnings.filterwarnings(ignore) # 加载数据集 df pd.read_csv(tmdb_5000_movies.csv) # 查看数据集信息 print(df.info()) 由于原数据集包含的…

DM数据库安装注意事项

数据库安装注意事项 一、安装前 一些参数需要在数据库创建实例前找用户确认。 参数名参数掩码参数值备注数据页大小PAGE_SIZE32数据文件使用的页大小(缺省使用8K&#xff0c;建议默认&#xff1a;32)&#xff0c;可以为 4K、8K、16K 或 32K 之一&#xff0c;选择的页大小越大…

UCB Data100:数据科学的原理和技巧:第十六章到第十八章

十六、交叉验证和正则化 Cross Validation and Regularization 译者&#xff1a;飞龙 协议&#xff1a;CC BY-NC-SA 4.0 学习成果 认识到需要验证和测试集来预览模型在未知数据上的表现 应用交叉验证来选择模型超参数 了解 L1 和 L2 正则化的概念基础 在特征工程讲座结束时…

QT上位机开发(进度条操作)

【 声明&#xff1a;版权所有&#xff0c;欢迎转载&#xff0c;请勿用于商业用途。 联系信箱&#xff1a;feixiaoxing 163.com】 进度条是一个比较常见的控件。如果某个操作需要很长的时间才能完成&#xff0c;那么这个时候最好有一个进度条提示&#xff0c;这样比较容易平复一…

鸿蒙(HarmonyOS)应用开发指南

1. 概述 1.1 简介 鸿蒙&#xff08;即 HarmonyOS &#xff0c;开发代号 Ark&#xff0c;正式名称为华为终端鸿蒙智能设备操作系统软件&#xff09;是华为公司自 2012 年以来开发的一款可支持鸿蒙原生应用和兼容 AOSP 应用的分布式操作系统。该系统利用“分布式”技术将手机、电…

centos 7 上如何安装chrome 和chrome-driver

centos 7 上如何安装chrome 和chrome-driver 查找自己的服务器是什么系统 cat /etc/os-release这里以centos linux 7为例 下载google-chrome安装包 wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm安装chrome sudo yum localinstall go…

C++ 输入用户名和密码 防止注入攻击

1、问题解释&#xff1a;注入攻击 &#xff0c;无密码直接登录数据库 可视化展示 1.1、当你的数据库为&#xff1a;其中包含三个字段id user 以及md5密码 1.2、在使用C堆数据库信息进行访问的时候&#xff0c;使用多条语句进行查询 string sql "select id from t_user…

阿里云最新优惠券领取方法及优惠活动汇总

随着互联网的飞速发展&#xff0c;云服务已经成为企业和个人使用的重要基础设施。阿里云作为全球领先的云服务提供商&#xff0c;一直致力于为用户提供优质的云服务。为了回馈用户&#xff0c;阿里云会定期推出各种优惠券和优惠活动&#xff0c;本文将为大家介绍阿里云最新优惠…

Unity中的异步编程【7】——在一个异步方法里播放了animation动画,取消任务时,如何停止动画播放

用一个异步方法来播放一个动画&#xff0c;正常情况是&#xff1a;动画播放结束时&#xff0c;异步方法宣告结束。那如果我提前取消这个异步任务&#xff0c;那在这个异步方法里面&#xff0c;我要怎么停止播放呢&#xff1f;&#xff01; 一、播放animation动画的异步实现 1…

医疗器械网络安全风险评定CVSS打分

为了完成医疗器械软件的网络安全风险评定相关文档&#xff0c;需要进行CVSS评分&#xff0c;这个评分对于第一次做的人来说感觉还是有些迷惑的&#xff0c;查了一些资料&#xff0c;留作参考。 CVSS 指的是 Common Vulnerability Scoring System&#xff0c;即通用漏洞评分系统…

七、HorizontalPodAutoscaler(HPA)

目录 一、HPA概述&#xff1a; 二、HPA工作机制&#xff1a; 三、HPA流程: 四、HPA API对象: 五、示例&#xff1a; 1、基于CPU的HPA 2、常见问题&#xff1a; 3、基于内存的HPA 一、HPA概述&#xff1a; Horizontal Pod Autoscaler&#xff0c;中文就是水平自动伸缩可…

JUC02同步和锁

同步&锁 相关笔记&#xff1a;www.zgtsky.top 临界区 临界资源&#xff1a;一次仅允许一个进程使用的资源成为临界资源 临界区&#xff1a;访问临界资源的代码块 竞态条件&#xff1a;多个线程在临界区内执行&#xff0c;由于代码的执行序列不同而导致结果无法预测&am…

mysql清空并重置自动递增初始值

需求&#xff1a;当上新项目时&#xff0c;测试环境数据库导出来的表id字段一般都有很大的初始递增值了&#xff0c;需要重置一下 先上代码&#xff1a; -- 查看当前自动递增值 SHOW CREATE TABLE table_name; -- 重建自动递增索引&#xff08;可选&#xff09; ALTER TABLE t…

初学者的基本 Python 面试问题和答案

文章目录 专栏导读1、什么是Python&#xff1f;列出 Python 在技术领域的一些流行应用。2、在目前场景下使用Python语言作为工具有什么好处&#xff1f;3、Python是编译型语言还是解释型语言&#xff1f;4、Python 中的“#”符号有什么作用&#xff1f;5、可变数据类型和不可变…

【深度学习:Micro-Models】用于标记图像和视频的微模型简介

【深度学习&#xff1a;Micro-Models】用于标记图像和视频的微模型简介 微模型&#xff1a;起源故事微模型到底是什么&#xff1f;更详细地解释微观模型&#xff1a;一维标签蝙蝠侠效率 在计算机视觉项目中使用微模型的额外好处面向数据的编程 在本文中&#xff0c;我们将介绍 …