mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-06-06 06:33:39 +00:00
Added borders to strings shown in STRG/SCAN previewers
This commit is contained in:
parent
836d1d404a
commit
56d132c194
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>47</height>
|
<height>38</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -16,6 +16,12 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
@ -128,13 +134,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="Line" name="Divider">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="WStringPreviewPanel" name="ScanTextWidget" native="true">
|
<widget class="WStringPreviewPanel" name="ScanTextWidget" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -5,11 +5,9 @@
|
|||||||
|
|
||||||
WStringPreviewPanel::WStringPreviewPanel(QWidget *pParent) : IPreviewPanel(pParent)
|
WStringPreviewPanel::WStringPreviewPanel(QWidget *pParent) : IPreviewPanel(pParent)
|
||||||
{
|
{
|
||||||
mpTextLabel = new QLabel(this);
|
|
||||||
mpTextLabel->setWordWrap(true);
|
|
||||||
mpLayout = new QVBoxLayout(this);
|
mpLayout = new QVBoxLayout(this);
|
||||||
mpLayout->setAlignment(Qt::AlignTop);
|
mpLayout->setAlignment(Qt::AlignTop);
|
||||||
mpLayout->addWidget(mpTextLabel);
|
mpLayout->setSpacing(0);
|
||||||
setLayout(mpLayout);
|
setLayout(mpLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,19 +27,24 @@ EResType WStringPreviewPanel::ResType()
|
|||||||
|
|
||||||
void WStringPreviewPanel::SetResource(CResource *pRes)
|
void WStringPreviewPanel::SetResource(CResource *pRes)
|
||||||
{
|
{
|
||||||
mpTextLabel->clear();
|
foreach(const QLabel *pLabel, mLabels)
|
||||||
|
delete pLabel;
|
||||||
|
mLabels.clear();
|
||||||
|
|
||||||
if (pRes && (pRes->Type() == eStringTable))
|
if (pRes && (pRes->Type() == eStringTable))
|
||||||
{
|
{
|
||||||
CStringTable *pString = static_cast<CStringTable*>(pRes);
|
CStringTable *pString = static_cast<CStringTable*>(pRes);
|
||||||
QString text;
|
mLabels.reserve(pString->GetStringCount());
|
||||||
|
|
||||||
for (u32 iStr = 0; iStr < pString->GetStringCount(); iStr++)
|
for (u32 iStr = 0; iStr < pString->GetStringCount(); iStr++)
|
||||||
{
|
{
|
||||||
if (iStr > 0) text += "\n";
|
QString text = QString::fromStdWString(pString->GetString(0, iStr));
|
||||||
text += QString::fromStdWString(pString->GetString(0, iStr));
|
QLabel *pLabel = new QLabel(text, this);
|
||||||
|
pLabel->setWordWrap(true);
|
||||||
|
pLabel->setFrameStyle(QFrame::Plain | QFrame::Box);
|
||||||
|
pLabel->setMargin(3);
|
||||||
|
mLabels.push_back(pLabel);
|
||||||
|
mpLayout->addWidget(pLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
mpTextLabel->setText(text);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
#include "IPreviewPanel.h"
|
#include "IPreviewPanel.h"
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QSpacerItem>
|
#include <QVector>
|
||||||
|
|
||||||
class WStringPreviewPanel : public IPreviewPanel
|
class WStringPreviewPanel : public IPreviewPanel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
QLabel *mpTextLabel;
|
QVector<QLabel*> mLabels;
|
||||||
QVBoxLayout *mpLayout;
|
QVBoxLayout *mpLayout;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user