我想使用Qxt的span滑块而不必安装它.这可能吗? [英] I would like to use the span slider from Qxt without having to install it. Is this possible?

查看:69
本文介绍了我想使用Qxt的span滑块而不必安装它.这可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我偶然发现了小工具为您提供了带有两个手柄的滑块,因此您可以在上限和下限之间选择一个范围.

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.

我想不用安装所有Qxt就可以使用它,因为我很确定这是我唯一需要的东西.

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.

我如何处理qxt_p()以便将此小部件独立使用?

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

推荐答案

您需要在主类中添加以下内容:

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;

此外,您应该删除Qwt宏用法,并直接访问 q_ptr d_ptr替换 qxt_d() qxt_q().

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;
  //...
}

万一我忘了一些东西,要点在这里.这段代码使我能够在Qt5中成功使用 QxtSpanSlider .

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

这篇关于我想使用Qxt的span滑块而不必安装它.这可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆