add book
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# Copyright (c) Daniel Gakwaya.
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(9-GroupBoxRadioCheckButton VERSION 0.1 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt6 6.5 REQUIRED COMPONENTS Quick QuickControls2)
|
||||
|
||||
qt_standard_project_setup(REQUIRES 6.5)
|
||||
|
||||
qt_add_executable(app9-GroupBoxRadioCheckButton
|
||||
main.cpp
|
||||
)
|
||||
|
||||
qt_add_qml_module(app9-GroupBoxRadioCheckButton
|
||||
URI 9-GroupBoxRadioCheckButton
|
||||
VERSION 1.0
|
||||
QML_FILES Main.qml
|
||||
)
|
||||
|
||||
set_target_properties(app9-GroupBoxRadioCheckButton PROPERTIES
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
MACOSX_BUNDLE TRUE
|
||||
WIN32_EXECUTABLE TRUE
|
||||
)
|
||||
|
||||
target_link_libraries(app9-GroupBoxRadioCheckButton
|
||||
PRIVATE Qt6::Quick Qt6::QuickControls2
|
||||
)
|
||||
|
||||
install(TARGETS app9-GroupBoxRadioCheckButton
|
||||
BUNDLE DESTINATION .
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) Daniel Gakwaya.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
Window {
|
||||
visible: true
|
||||
width: 640
|
||||
height: 480
|
||||
title: qsTr("GroupBox")
|
||||
|
||||
Column{
|
||||
spacing: 10
|
||||
anchors.fill: parent
|
||||
|
||||
//RadioButton controls
|
||||
Label {
|
||||
width: parent.width
|
||||
wrapMode: Label.Wrap
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
text: "A GroupBox wrapping around RadioButtons."
|
||||
}
|
||||
|
||||
GroupBox{
|
||||
title: "Choose bonus"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
Column{
|
||||
|
||||
RadioButton{
|
||||
text: "Coke"
|
||||
onCheckedChanged: {
|
||||
if( checked){
|
||||
console.log("Coke button checked")
|
||||
}else{
|
||||
console.log("Coke button is NOT checked")
|
||||
}
|
||||
}
|
||||
}
|
||||
RadioButton{
|
||||
text: "Green Tea"
|
||||
}
|
||||
RadioButton{
|
||||
text: "Ice Cream"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CheckBox Controls
|
||||
Label {
|
||||
width: parent.width
|
||||
wrapMode: Label.Wrap
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
text: "A GroupBox wrapping around CheckBoxes."
|
||||
}
|
||||
|
||||
|
||||
GroupBox{
|
||||
title: "Choose Qt supported Desktop Platform"
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
Column{
|
||||
|
||||
CheckBox{
|
||||
text: "Windows"
|
||||
onCheckedChanged: {
|
||||
if( checked){
|
||||
console.log("Windows button checked")
|
||||
}else{
|
||||
console.log("Windows button is NOT checked")
|
||||
}
|
||||
}
|
||||
}
|
||||
CheckBox{
|
||||
text: "Mac"
|
||||
}
|
||||
CheckBox{
|
||||
text: "Linux"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) Daniel Gakwaya.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQuickStyle>
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
QQuickStyle::setStyle("Universal");
|
||||
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
|
||||
&app, []() { QCoreApplication::exit(-1); },
|
||||
Qt::QueuedConnection);
|
||||
engine.loadFromModule("9-GroupBoxRadioCheckButton", "Main");
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user