Giter Club home page Giter Club logo

tabtoolbar's Introduction


Build status Build Status

As stated above, TabToolbar is a small library, meant to be used with Qt, that provides a few classes for creating of tabbed toolbars.

Features:

  • Cross-platform - TabToolbar depends only on Qt and requires a C++11 compliant compiler to be built.
  • Native look and feel - TabToolbar has a few predefined styles, which use current OS's palette to generate the best looking style possible. Moreover styles can be created and changed dynamically at runtime!
  • Configurable - UI configuration can be set directly from code, or loaded from JSON file! This enables easy UI fine-tuning and customization.
  • Customizable - UI can contain any custom widget! If you use JSON configs, all you have to do is to tell TabToolbar, how to create them, and you are good to go!
  • Non-exclusive - TabToolbar can be easily combined with classic menu bars! Consider a CAD application, that uses TabToolbar and places it's most used actions in it, while combining it with menu bar, which contains other less-frequently used actions.

Styles:

TabToolbar comes with four predefined styles:

  • Vienna (default for Windows 7 OS)
  • Threshold (default for all Windows >= 8 OSes)
  • Kool (default for Unix-like systems)
  • White Mercy a simple white reskin of Threshold style

All these styles use current OS palette and thus look great with any theme (light, dark, you name it). Each style can be used on any OS.

Some examples:

Vienna style on Windows 7:

Kool style on Manjaro KDE with Breeze Dark theme:

Threshold style on Manjaro LXQt with gtk2 theme:

White Mercy style on Windows 10:

Building

TabToolbar uses CMake and depends on Qt >= 5.3. A simple example project of how to use TabToolbar is included, but is by default not included in build.

Usage

To link TabToolbar to your project, you can use provided FindTabToolbar cmake module, which defines TabToolbar_LIBRARY variable that you can feed to your target_link_libraries command.

An example project is also included in examples/Test subdirectory, please refer to it if you have any troubles.

License

TabToolbar uses LGPL license either version 3 or any later version.

TabToolbar logo generously provided by Tobaloidee

tabtoolbar's People

Contributors

jared2020 avatar jaredtao avatar ojura avatar seriousalexej avatar tobaloidee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tabtoolbar's Issues

Drag&Drop separator

Is it possible to make the Groups dinamically change their width? E.g. by Drag&Drop the separators.

Dual Screen Crash

Hi, I have a TabToolbar that works fine when using a single screen. But when I open the project with a dual screen attached to my computer, it crashes.

I found that the crash happens in this function when opened with debug mode. (StyleTools.cpp)

float GetScaleFactor(const QWidget& widget)
{
#if (QT_VERSION <= QT_VERSION_CHECK(5, 10, 0))
    auto scrNumber = QApplication::desktop()->screenNumber(widget.mapToGlobal(QPoint(0,0)));
    auto screens = QGuiApplication::screens();
    QScreen* scr = screens.at(scrNumber);
#else
    QScreen* scr = QGuiApplication::screenAt(widget.mapToGlobal(QPoint(0,0)));
#endif
    const float defaultDpi = 96.0f;
    return scr->logicalDotsPerInchY() / defaultDpi;
}

By the way, my screens have different resolutions.

1st screen: 1920x1080 (16.9)
2nd screen: 2560x1440 (16:9)

Anyone have any ideas about the problem? Thanks.

Window crash when installing Arabic translator (RightToLeft)

Hello, my application crash when I install the translator (in Arabic, layout rightToLeft) before creating the toolbar. it crash on :
group->AddAction(QToolButton::DelayedPopup, ui.actionAddImage);

After digging in the code I found a null screen has been returned in GetScaleFactor . removing the else, by changing the function as follow has fix the problem:

float GetScaleFactor( const QWidget& widget)
{
    auto scrNumber = QApplication::desktop()->screenNumber(&widget);
    auto screens = QGuiApplication::screens();
    QScreen* scr = screens.at(scrNumber);
    const float defaultDpi = 96.0f;
    return scr->logicalDotsPerInchY() / defaultDpi;
}

I am running on Qt 5.14, MSVC 2019 on Windows 10.

Support for High-DPI screens

Currently there are issues when high-dpi screens with scaling are used. Consider the attachments for illustration. One is Ubuntu 18.04@1920*1080. The other one is when double scaling was activated in Ubuntu (Settings -> Screen -> Scale -> 200%),
100_percent
Text under icons is cut off. Also, the size of the icons in the icon group in relation to the larger icons seems to be off.
200_percent

Cannot open the TabToolbar/TabToolbar.h in the example/Test project

Hi, @SeriousAlexej thanks for your perfect work. I am a new coder and I have built the Test project successfully use the command 'cmake .'
However, when I open the 'sln' project, it have many errors like this 'cannot open src file 'TabToolbar/TabToolbar.h'.
I think I should do something about the cmake-modules/FindTabToolbar.cmake to install some lib source? What should I do? Thanks~

P.S. My computer OS is Win10, and use vs 2019 to compile.

How to connect signal and slots for itemType = "action"?

How to connect signal and slots for itemType = "action"?

There's an action like:

{
    "itemType": "action",
    "type": "instantPopup",
    "name": "actionExit"
}

But when I find actionExit that it occurs and nullptr.

Example:

  QToolButton *actionExit = (QToolButton *)ttb["actionExit"];
  if (actionExit != nullptr) {
    QObject::connect(actionExit, &QToolButton::triggered, this,
                     &CMainWindow::actionExit);
  } else {
    cout << "Error: actionExit is null" << endl;
  }

output:

"Error: actionExit is null".

I replaced QToolButton* to QAction*, but it doesn't work.

Or it goes:

  QToolButton *actionExit = (QToolButton *)ttb["actionExit"];
  QObject::connect(actionExit, &QToolButton::triggered, this,
                     &CMainWindow::actionExit);

or

  QAction *actionOpen = (QAction *)ttb["actionOpen"];
  QObject::connect(actionOpen, &QAction::triggered, [tabToolbar, this]() {
    QMessageBox::information(this, "OK", "OK");
  });

They all output:

QObject::connect(QAction, Unknown): invalid nullptr parameter

please help me

Interface errors?

Доброго дня!
(Qt 5.14.0 / Qt Des 4.11.2 x64)
Основное: спасибо за твой труд! Великолепно.
Надеюсь я не ошибся и ты читаешь по русски :).

Итак:
Без использования

QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

Никакого масштабирования интерфейса нет.

Может я чего-нибудь не понимаю, особенно учитывая то, что код библиотеки включается непосредственно в проект, а не используется как внешняя dll, но функции смены темы не оказывают никакого влияния:

    tt->SetStyle("Kool"); //-- установки темы, наиболее близкой к "fusion"
    //tt->SetStyle("Vienna");
    //tt->SetStyle("Threshold");

Всё всегда как на картинках ниже. Без изменений.

На мониторе с 4K разрешением под Win10, сразу после старта программы:

image

image

image

Ну, комментарии излишни. Используется последняя версия библиотеки.

Да, еще один момент. Можно попросить переименовать все исходные модули (файлы) в нижний регистр?

Logo Proposal

Hi @SeriousAlexej good day! I am a graphics designer and i passed by your good project and noticed that it doesn't have a logo that's why i thought of contributing here by designing a logo for free..If you will permit me i will start my design asap.Thanks and best regards!

-tobaloidee

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.