| 54 | } // namespace |
| 55 | |
| 56 | SampleView::SampleView(QWidget * parent, Framework & framework) : QWidget(parent), m_framework(framework) |
| 57 | { |
| 58 | m_framework.GetBookmarkManager().GetEditSession().SetIsVisible(UserMark::Type::SEARCH, true); |
| 59 | m_framework.GetBookmarkManager().GetEditSession().SetIsVisible(UserMark::Type::COLORED, true); |
| 60 | |
| 61 | auto * mainLayout = BuildLayout<QVBoxLayout>(this /* parent */); |
| 62 | |
| 63 | // When the dock for SampleView is attached to the right side of the |
| 64 | // screen, we don't need left margin, because of zoom in/zoom out |
| 65 | // slider. In other cases, it's better to keep left margin as is. |
| 66 | m_defaultMargins = mainLayout->contentsMargins(); |
| 67 | m_rightAreaMargins = m_defaultMargins; |
| 68 | m_rightAreaMargins.setLeft(0); |
| 69 | |
| 70 | { |
| 71 | m_query = new QLabel(this /* parent */); |
| 72 | m_query->setToolTip(tr("Query text")); |
| 73 | m_query->setWordWrap(true); |
| 74 | m_query->hide(); |
| 75 | mainLayout->addWidget(m_query); |
| 76 | } |
| 77 | |
| 78 | { |
| 79 | m_langs = new QLabel(this /* parent */); |
| 80 | m_langs->setToolTip(tr("Query input language")); |
| 81 | m_langs->hide(); |
| 82 | mainLayout->addWidget(m_langs); |
| 83 | } |
| 84 | |
| 85 | { |
| 86 | auto * layout = BuildSubLayout<QHBoxLayout>(*mainLayout, *this /* parent */); |
| 87 | |
| 88 | m_showViewport = new QPushButton(tr("Show viewport"), this /* parent */); |
| 89 | connect(m_showViewport, &QPushButton::clicked, [this]() { emit OnShowViewportClicked(); }); |
| 90 | layout->addWidget(m_showViewport); |
| 91 | |
| 92 | m_showPosition = new QPushButton(tr("Show position"), this /* parent */); |
| 93 | connect(m_showPosition, &QPushButton::clicked, [this]() { emit OnShowPositionClicked(); }); |
| 94 | layout->addWidget(m_showPosition); |
| 95 | } |
| 96 | |
| 97 | { |
| 98 | auto * layout = BuildSubLayout<QVBoxLayout>(*mainLayout, *this /* parent */, &m_relatedQueriesBox); |
| 99 | SetVerticalStretch(*m_relatedQueriesBox, 1 /* stretch */); |
| 100 | |
| 101 | layout->addWidget(new QLabel(tr("Related queries"))); |
| 102 | |
| 103 | m_relatedQueries = new QListWidget(); |
| 104 | layout->addWidget(m_relatedQueries); |
| 105 | } |
| 106 | |
| 107 | { |
| 108 | auto * layout = BuildSubLayout<QHBoxLayout>(*mainLayout, *this /* parent */); |
| 109 | |
| 110 | m_markAllAsRelevant = new QPushButton(tr("Mark all as Relevant"), this /* parent */); |
| 111 | connect(m_markAllAsRelevant, &QPushButton::clicked, [this]() { emit OnMarkAllAsRelevantClicked(); }); |
| 112 | layout->addWidget(m_markAllAsRelevant); |
| 113 |
nothing calls this directly
no test coverage detected