Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I would like to use the span slider from Qxt without having to install it. Is this possible?

Tags:

c++

qt

I stumbled across a widget that provides you with a slider with two handles so you can select a range between an upper and lower limit.

I would like to use it without having to install all of Qxt though, since I am pretty sure this is the only thing that I need.

How can I deal with qxt_p() in order to use this widget as a standalone?

like image 498
dearn44 Avatar asked Oct 12 '25 09:10

dearn44


1 Answers

You need to add the following in the main class:

private:
  QxtSpanSliderPrivate* d_ptr;
  friend class QxtSpanSliderPrivate;

And in the following in the private class:

private:
  QxtSpanSlider* q_ptr;
  friend class QxtSpanSlider;

Also you should remove Qwt macros usage and replace qxt_d() and qxt_q() with direct access to q_ptr and d_ptr.

Each constructor of the main class should initialize both pointers:

QxtSpanSlider::QxtSpanSlider(Qt::Orientation orientation, QWidget* parent) :
  QSlider(orientation, parent), 
  d_ptr(new QxtSpanSliderPrivate())
{
  d_ptr->q_ptr = this;
  //...
}

In case I forgot something, here is the gist. This code allowed me to successfully use QxtSpanSlider in Qt5.

like image 56
Pavel Strakhov Avatar answered Oct 15 '25 00:10

Pavel Strakhov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!