Skip to content

eveiljuice/QuizEditor

Repository files navigation

QuizEditor

A desktop quiz editor with drag-and-drop reordering for both questions and answers, and XML import/export. Originally written for Qt 4.8 and ported to Qt 6 (CMake, C++17).

Screenshot of QuizEditor

Features

  • Multiple-choice questions with any number of answers per question.
  • Drag-and-drop to reorder questions and to reorder answer options within a question. Drops are scoped per container — answers can't be accidentally moved to a different question.
  • XML save/load with a simple, human-readable schema (see example.xml).
  • Mark-as-correct checkboxes for any number of answers per question.
  • Question sections (chapter numbers) for grouping in the output XML.
  • Unsaved-changes guard on New / Open / Close.

Requirements

  • Qt 6.2 or newer (modules: Core, Gui, Widgets, Xml).
  • CMake 3.19 or newer.
  • A C++17 compiler:
    • Windows: MSVC 2019/2022 (bundled with Qt 6) or MinGW 8.1+.
    • Linux: GCC 9+ or Clang 10+.
    • macOS: Apple Clang 12+.

Build (Windows + PowerShell)

The repository ships with a CMake project. A copy-paste build:

# 1) Point CMake at your Qt 6 install and put Qt + MinGW on PATH.
$env:CMAKE_PREFIX_PATH = "C:\Qt\6.11.1\mingw_64"
$env:Path = "C:\Qt\6.11.1\mingw_64\bin;C:\Qt\Tools\mingw1310_64\bin;C:\Program Files\CMake\bin;$env:Path"

# 2) Configure (Ninja is the fastest generator on Windows).
& "C:\Qt\Tools\CMake_64\bin\cmake.exe" -S . -B build -G Ninja `
    -DCMAKE_BUILD_TYPE=Release `
    -DCMAKE_MAKE_PROGRAM="C:\Qt\Tools\Ninja\ninja.exe"

# 3) Build.
& "C:\Qt\Tools\CMake_64\bin\cmake.exe" --build build

# 4) Run.
.\build\QuizEditor.exe

If Windows can't find Qt6Core.dll and friends, either re-launch from a shell where C:\Qt\6.11.1\mingw_64\bin is on PATH, or run:

& "C:\Qt\6.11.1\mingw_64\bin\windeployqt.exe" --release build\QuizEditor.exe

windeployqt copies the runtime DLLs and platform plugins next to the executable, producing a folder you can zip and ship to other Windows machines.

Build (Linux / macOS)

export CMAKE_PREFIX_PATH=/opt/Qt/6.7.0/gcc_64     # or your Qt 6 prefix
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
./build/QuizEditor

Build (Qt Creator)

  1. File → Open File or Project… and pick CMakeLists.txt.
  2. Qt Creator detects the kit and CMAKE_PREFIX_PATH automatically.
  3. Build → Run.

XML format

saveToFile writes a simple UTF-8 document:

<?xml version="1.0" encoding="UTF-8"?>
<controls>
  <ukmControl>
    <qwestions>
      <qwestion title="" id="c_1" chapter="">
        <answers orderRight="0,2" orderUser="-1">
          <answer>…</answer>
          <answer>…</answer>
        </answers>
      </qwestion>
      …
    </qwestions>
    <doing>Нет</doing>
    <id>1</id>
  </ukmControl>
</controls>
  • orderRight — comma-separated zero-based indexes of the correct answers.
  • chapter is normalized to h_<name> if it isn't already prefixed.
  • A sample file is in example.xml.

Project layout

QuizEditor/
├── CMakeLists.txt            # Qt 6 build script
├── app.rc                    # Windows icon resource
├── application.qrc           # Qt resources (icons, .qrc → rcc)
├── main.cpp                  # Entry point, sets Fusion style
├── quizcreator.{h,cpp,ui}    # Main window
├── questionwidget.{h,cpp}    # One question card with answers
├── answerrow.{h,cpp}         # One answer row (text + correct-checkbox + drag)
├── images/                   # Toolbar icons + app icon (.ico/.svg)
├── docs/screenshot.png       # Screenshot used in this README
├── example.xml               # Sample quiz in the saved format
└── LICENSE                   # MIT

Porting notes (Qt 4.8 → Qt 6)

Qt 4.8 / old Qt 6
#include <QtGui> #include <QtWidgets>
QApplication::setStyle(new QPlastiqueStyle) QStyleFactory::create("Fusion")
QTextCodec::setCodecForCStrings(...) removed (UTF-8 is the default)
SIGNAL(...) / SLOT(...) &Class::signal / &Class::slot
parent = 0 parent = nullptr
Implicit <QFile> / <QMessageBox> explicit #include
qmake (.pro) CMake (CMakeLists.txt) + AUTOMOC/AUTORCC/AUTOUIC
xml.writeStartDocument() w/o version xml.writeStartDocument("1.0")
closeEvent without override override added
QString::SkipEmptyParts Qt::SkipEmptyParts
QDropEvent::pos() QDropEvent::position().toPoint()

License

MIT.

About

Desktop quiz editor with drag-and-drop reordering. Qt 6 / CMake / C++17.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors