Say hello to QRangeSelector!

September 12, 2009

As suggested yesterday, I’ve set up a Git repository for “a broad collection of smaller code pieces which I’ve acquired over the course of my life”. Find it at http://github.com/majewsky/majewsky-misc/, and clone it from git://github.com/majewsky/majewsky-misc.git.

As some first entry, I actually put some stuff I’m currently working on. In line with Andreas Marschke writing about his recent work on a generic video widget, I’m announcing QRangeSelector. This class is similar to a normal slider, but it does not only allow to select a single value, but to select a range of values from some bigger range. (One may also, given some big range, select a small range from it, and select a value within this range.) QRangeSelector also allows for arbitrary contents to be drawn inside its slider area. This screenshot illustrates some usecases which I need in Kolf. (If you do not see the benefit yet, I’ll do a screencast once the QRangeSelector is used in Kolf.)

Testcase for QRangeSelector widget

Testcase for QRangeSelector widget

Note: The white widgets at the top and inbetween the two QRangeSelectors are simple line edits. I needed those to test keyboard focus.

Advertisements

8 Responses to “Say hello to QRangeSelector!”

  1. xxtjaxx Says:

    will you turn it into a coller code ?
    I think a 2 part widget with a color chooser area and a line edit to control it the other way around would be teriffic! 🙂 Keep up!

    • Stefan Majewsky Says:

      The widget with the black-white background is actually meant for grayscale color choosing. I do not have any needs beyond this currently.

  2. Matthias Pospiech Says:

    As far as I know, the libqxt library already offers such a widget. However their one looks like the normal slider, and is not colored like yours.

  3. Thiago Macieira Says:

    Why are you using GitHub for this? Given the name you chose for your class, it sounds like you want it to be part of Qt. So you need to send it as a merge request via Gitorious, not GitHub.

    • Stefan Majewsky Says:

      The “Q” prefix indicates that it is based on Qt, and uses a Qt-style API. However, it’s tailored towards the usecases which I need it for in Kolf. Though it’s written in a generic way, it’s probably not generic enough for Qt. (I might rewrite it in a more generic way later on and send a merge request via my qt-clone repo on Gitorious.)

  4. LukasT Says:

    This is something that I need in Krita. To be able to select intervals..maybe I will copy it in Krita if license allows…

    • Stefan Majewsky Says:

      License is not a problem. The MIT license is GPL compatible, i.e. you can use MIT-licensed code in GPL projects. Also, I’m going to put a GPL-licensed version of the code into Kolf’s source tree, which you can then also copy.

      During all licensing considerations, please note that IANAL (I Am Not A Lawyer).

      Apart from all of this, you should look into whether you want QRangeSelector or the QxtSpanSlider (see http://doc.libqxt.org/0.5.0/classQxtSpanSlider.html as mentioned above). The latter one is more useful if you do not need custom backgrounds.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s