C++ } }//结束名称空间qtutil,cvv #endif//CVVISUAL\u COLLAPSABLE\u H
我将跟进来自@Cris Luengo的#include评论,因为我想了解我的构建出了什么问题 然而,我也找到了一种不同的安装方法,我刚刚在测试中取得了成功 链接在这里 提供了一个工具链,以及关于如何启用该选项的说明。在我找到这个网站之前,我已经安装了VisualStudio2015和2019,我不知道这是否有区别,但其中一条评论说使用2015 我按照说明手动编辑setup.py文件。我以管理员身份从Windows命令行运行所有步骤 主站点提供了OpenCV的预构建版本,没有非免费代码,并且使用的是其工具链的副本。 我将跟进@Cris Luengo的“include”评论,因为我想了解我的构建出了什么问题 然而,我也找到了一种不同的安装方法,我刚刚在测试中取得了成功 链接在这里 提供了一个工具链,以及关于如何启用该选项的说明。在我找到这个网站之前,我已经安装了VisualStudio2015和2019,我不知道这是否有区别,但其中一条评论说使用2015 我按照说明手动编辑setup.py文件。我以管理员身份从Windows命令行运行所有步骤 主站点提供了OpenCV的预构建版本,没有非免费代码,并且使用的是其工具链的副本。C++ } }//结束名称空间qtutil,cvv #endif//CVVISUAL\u COLLAPSABLE\u H,c++,opencv,image-processing,sift,opencv-contrib,C++,Opencv,Image Processing,Sift,Opencv Contrib,我将跟进来自@Cris Luengo的#include评论,因为我想了解我的构建出了什么问题 然而,我也找到了一种不同的安装方法,我刚刚在测试中取得了成功 链接在这里 提供了一个工具链,以及关于如何启用该选项的说明。在我找到这个网站之前,我已经安装了VisualStudio2015和2019,我不知道这是否有区别,但其中一条评论说使用2015 我按照说明手动编辑setup.py文件。我以管理员身份从Windows命令行运行所有步骤 主站点提供了OpenCV的预构建版本,没有非免费代码,并且使用
昨天我也遇到了完全相同的问题。。你知道是什么导致了这个问题吗? 有趣的是,我使用相同的开发步骤,使用非自由算法(包括OpenCV_cvv)构建了OpenCV。两个系统之间的区别在于MSVC和Qt版本 前者为MSVC 19.25.28614.0,当前为MSVC 19.26.28805.0。 以前的Qt版本是5.14.2,新版本是5.15.0 我使用了Github fork中的OpenCV 4.3.0版本和OpenCV Contrib
如果您得到了解决方案,请同时告诉我们昨天我也遇到了完全相同的问题。。你知道是什么导致了这个问题吗? 有趣的是,我使用相同的开发步骤,使用非自由算法(包括OpenCV_cvv)构建了OpenCV。两个系统之间的区别在于MSVC和Qt版本 前者为MSVC 19.25.28614.0,当前为MSVC 19.26.28805.0。 以前的Qt版本是5.14.2,新版本是5.15.0 我使用了Github fork中的OpenCV 4.3.0版本和OpenCV Contrib
如果您得到了解决方案,请告诉我们
。/util/observer_ptr.hpp
中出现了错误。它可能缺少一个#include
,因为这是根据标准声明的std::logic_error
。感谢您的反馈,我将查找此错误发生在。/util/observer_ptr.hpp
中。它可能缺少一个#include
,因为根据标准,std::logic\u error
就是在这里声明的。谢谢你的反馈,我会查找的。恐怕我太忙了,无法跟进。在调试时,我确实尝试了旧版本的软件,但也出现了同样的错误。我觉得很奇怪。我使用的方法更简单、更快。我没有发现任何关于发布的软件有错误的评论。我是一名硕士生,因此我在构建此类代码方面的知识水平非常低,因此我不知道是否可以安装其他可以进行交互的东西。您是否尝试了@Cris Luengo添加#include in../util/observer_ptr.hpp的方法?有效吗?对不起,我没有试过。恐怕我太忙了,没时间跟进。在调试时,我确实尝试了旧版本的软件,但也出现了同样的错误。我觉得很奇怪。我使用的方法更简单、更快。我没有发现任何关于发布的软件有错误的评论。我是一名硕士生,因此我在构建此类代码方面的知识水平非常低,因此我不知道是否可以安装其他可以进行交互的东西。您是否尝试了@Cris Luengo添加#include in../util/observer_ptr.hpp的方法?有用吗?对不起,我没试过。
#include "collapsable.hpp"
namespace cvv
{
namespace qtutil
{
Collapsable::Collapsable(const QString &title, std::unique_ptr<QWidget> widget,
bool isCollapsed, QWidget *parent)
: QFrame{ parent }, widget_{ widget.get() }, layout_{ nullptr }
{
auto lay = util::make_unique<QVBoxLayout>();
layout_ = *lay;
// set alignment+border
setLineWidth(1);
setFrameStyle(QFrame::Box);
layout_->setAlignment(Qt::AlignTop);
layout_->setContentsMargins(0, 0, 0, 0);
// build header
auto tmpButton = util::make_unique<QPushButton>();
button_ = tmpButton.get();
button_->setEnabled(true);
button_->setText(title);
button_->setCheckable(true);
// build widget
setLayout(lay.release());
layout_->addWidget(tmpButton.release());
layout_->addWidget(widget.release());
// connect signals and slots
QObject::connect(button_, SIGNAL(clicked()), this,
SLOT(toggleVisibility()));
// collapse/ expand according to isCollapsed
collapse(isCollapsed);
}
// Collapsable::Collapsable(const QString& title,QWidget& widget, bool
// isCollapsed, QWidget *parent):
// Collapsable{title, std::unique_ptr<QWidget>{&widget}, isCollapsed,
//parent} {}
void Collapsable::collapse(bool b)
{
button_->setChecked(!b);
if (b)
{
widget_->hide();
}
else
{
widget_->show();
}
}
QWidget *Collapsable::detachWidget()
{
if (!widget_)
{
return nullptr;
}
layout_->removeWidget(widget_);
QWidget *tmp = widget_;
widget_ = nullptr;
return tmp;
}
}
} // end namespaces qtutil, cvv
#ifndef CVVISUAL_COLLAPSABLE_H
#define CVVISUAL_COLLAPSABLE_H
// std
#include <cstddef>
// QT
#include <QString>
#include <QWidget>
#include <QPushButton>
#include <QVBoxLayout>
#include <QLabel>
#include <QFrame>
#include "../util/util.hpp"
#include "../util/observer_ptr.hpp"
namespace cvv
{
namespace qtutil
{
/**
* @brief Contains a widget and a title.
*
* The widget can be collapsed and expanded with a button.
* If the widget is collapsed only button and title are shown.
*/
class Collapsable : public QFrame
{
Q_OBJECT
public:
/**
* @brief Constructs a collapsable
* @param title The title above the widget.
* @param widget The widget to store.
* @param isCollapsed If true the contained widget will be collapsed.
* (It will be shown
* otherwise.)
*/
// explicit Collapsable(const QString& title, QWidget& widget, bool
// isCollapsed = true,
// QWidget *parent = 0);
explicit Collapsable(const QString &title,
std::unique_ptr<QWidget> widget,
bool isCollapsed = true, QWidget *parent = 0);
~Collapsable()
{
}
/**
* @brief Collapses the contained widget.
* @param b
* @parblock
* true: collapses the widget
* false: expands the widget
* @endparblock
*/
void collapse(bool b = true);
/**
* @brief Expands the contained widget.
* @param b
* @parblock
* true: expands the widget
* false: collapses the widget
* @endparblock
*/
void expand(bool b = true)
{
collapse(!b);
}
/**
* @brief Sets the title above the widget.
*/
void setTitle(const QString &title)
{
button_->setText(title);
}
/**
* @brief Returns the current title above the widget.
* @return The current title above the widget
*/
QString title() const
{
return button_->text();
}
/**
* @brief Returns a reference to the contained widget.
* @return A reference to the contained widget.
*/
QWidget &widget()
{
return *widget_;
}
const QWidget &widget() const
{
return *widget_;
}
/**
* @brief Detaches the contained widget. (ownership remains)
* @return The contained widget
*/
QWidget *detachWidget();
private
slots:
/**
* @brief Toggles the visibility.
*/
void toggleVisibility()
{
collapse(widget_->isVisible());
}
private:
/**
* @brief The contained widget
*/
QWidget *widget_;
/**
* @brief The button to toggle the widget
*/
QPushButton *button_;
/**
* @brief The layout containing the header and widget
*/
util::ObserverPtr<QVBoxLayout> layout_;
}; // Collapsable
}
} // end namespaces qtutil, cvv
#endif // CVVISUAL_COLLAPSABLE_H