A modern, feature-rich calculator application built with Qt 6 and QML, featuring a sleek digital display and comprehensive arithmetic operations.
- Basic Operations: Addition, subtraction, multiplication, and division
- Advanced Operations:
- Square root (√)
- Square (x²)
- Percentage (%)
- Error Handling:
- Division by zero protection
- Negative square root detection
- Overflow and infinity handling
- User Experience:
- Digital font display (DS-DIGIB)
- Intuitive button layout
- Visual operator feedback
- Backspace/delete functionality
- Clear/reset functionality
- Qt 6.6 or later
- CMake 3.16 or later
- C++17 compatible compiler
-
Clone the repository:
git clone https://github.com/faelbluhm/SimpleQalculator cd SimpleQalculator
-
Create build directory:
mkdir build && cd build
-
Configure and build:
cmake .. make
-
Run the application:
./calculator
- Open
CMakeLists.txt
in Qt Creator - Configure the project with your Qt kit
- Build and run (Ctrl+R)
The application follows a clean separation of concerns:
- CalculatorLogic (C++): Core calculation engine and business logic
- Main.qml: User interface and visual components
- Signal/Slot Pattern: Qt's signal-slot system for UI-logic communication
├── calculatorlogic.h/cpp # Core calculator logic
├── main.cpp # Application entry point
├── Main.qml # QML user interface
├── fonts/DS-DIGIB.TTF # Digital display font
└── CMakeLists.txt # Build configuration
- Click number buttons (0-9) to input values
- Use +, -, ×, ÷ for basic arithmetic
- Press = to calculate results
- √: Square root of current number
- x²: Square of current number
- %: Percentage calculation
- C: Clear all and reset
- ⌫: Delete last digit
- .: Decimal point
Error: DIV 0
: Division by zeroError: √-
: Square root of negative numberError: OB
: Number too large for displayError: Inf
: Result is infinity
The calculator uses a state-machine approach with the following key states:
- Display text management
- Operator precedence handling
- Error state management
- Input validation
CalculatorLogic
- Handles all mathematical operations
- Manages calculator state
- Provides Qt property bindings for QML
- Implements comprehensive error handling
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Follow Qt coding conventions
- Ensure all operations have appropriate error handling
- Add unit tests for new functionality
- Update documentation as needed
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- ✅ Commercial use
- ✅ Modification
- ✅ Distribution
- ✅ Patent use
- ✅ Private use
- ❌ Liability
- ❌ Warranty
- 📋 License and copyright notice required
- 📋 State changes required
- 📋 Disclose source required
- 📋 Same license required
- Qt Framework for the excellent development platform
- DS-DIGIB font for the authentic digital calculator display
- The open-source community for inspiration and best practices
If you encounter any issues or have questions:
- Check the issues page
- Create a new issue with detailed information
- Include your Qt version and operating system
Made with ❤️ using Qt 6 and QML