本文整理汇总了C++中QTextEdit::setFrameStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextEdit::setFrameStyle方法的具体用法?C++ QTextEdit::setFrameStyle怎么用?C++ QTextEdit::setFrameStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextEdit
的用法示例。
在下文中一共展示了QTextEdit::setFrameStyle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawShape
void DPText::drawShape( QPainter &p )
{
QRect bound = m_sizeRect;
bound.setWidth( bound.width()-2 );
bound.setHeight( bound.height()-2 );
bound.translate( int(x()+1), int(y()+1) );
if (b_displayBackground)
{
p.save();
p.setPen( QPen( m_frameColor, 1, Qt::DotLine) );
p.setBrush(m_backgroundColor);
p.drawRect(bound);
p.restore();
}
const int pad = 6;
bound.setLeft( bound.left()+pad );
bound.setTop( bound.top() );
bound.setRight( bound.right()-pad );
bound.setBottom( bound.bottom()-pad );
QTextEdit * t = new QTextEdit( m_text );
t->resize( bound.width(), bound.height() ); // t->setWidth( bound.width() );
t->viewport()->setAutoFillBackground( false );
t->setFrameStyle(QFrame::NoFrame);
t->render( &p, bound.topLeft(), QRegion(), QWidget::DrawChildren ); //t->draw( &p, bound.left(), bound.top(), bound, QColorGroup() );
delete t;
}
示例2: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
//ui->setupUi(this);
//ustvarim Widget
centralWidget = new QWidget(this);
this->setCentralWidget( centralWidget );
centralWidget->setWindowTitle("DLX");
centralWidget->setMaximumSize(1000, 1000);
centralWidget->setMinimumSize(10, 10);
centralWidget->resize(400,400);
mainLayout = new QGridLayout( centralWidget );
mainLayout->setSpacing(0);
for(int mr = 0; mr < 3; mr++)//ustvarim 3 vrstice
{
for(int mc = 0; mc < 3; mc++)//ustvarim 3 stolpce
{
//veliki robovi
QFrame * widget = new QFrame;
widget->setFrameStyle(QFrame::Plain);
widget->setFrameShape(QFrame::Box);
//znotraj velikih robov se en grid
QGridLayout * gridLayout = new QGridLayout(widget);
gridLayout->setSpacing(0);
gridLayout->setMargin(0);
for(int r = 0; r < 3; r++)//3 vrstice
{
for(int c = 0; c < 3; c++)//3 stolpci
{
//ustvarim skatlo s textom
QTextEdit * tile = new QTextEdit("");
tile->setFrameStyle(QFrame::Plain);
tile->setFrameShape(QFrame::Box);
tile->setAlignment(Qt::AlignCenter);
tile->setTabChangesFocus(true);
tile->setStyleSheet("font: 24pt ;");
gridLayout->addWidget(tile, r, c, 1, 1, Qt::AlignCenter);
}
}
mainLayout->addWidget(widget, mr, mc, 1, 1, Qt::AlignCenter);
}
}
//ustvarim menu z eventom
QMenuBar* menuBar = new QMenuBar();
QMenu *fileMenu = new QMenu("Algoritem");
menuBar->addMenu(fileMenu);
QAction *helpAction = fileMenu->addAction("Find solution");
connect(helpAction, SIGNAL(triggered()), this, SLOT(algoritem()));
centralWidget->layout()->setMenuBar(menuBar);
QMenu *fileMenu1 = new QMenu("Input");
menuBar->addMenu(fileMenu1);
QAction *Action = fileMenu1->addAction("Reset");
connect(Action, SIGNAL(triggered()), this, SLOT(reset()));
QAction *Action2 = fileMenu1->addAction("Qassim Hamza");
connect(Action2, SIGNAL(triggered()), this, SLOT(hamza()));
}
示例3: outputPath
/// Constructor
OutputDialog::OutputDialog(QString outpath, QString result, QWidget *parent)
: outputPath(outpath), QDialog(parent)
{
resize(780, 580);
QVBoxLayout *topLayout = new QVBoxLayout(this);
QTabWidget * tabs = new QTabWidget(this);
QTextEdit * outText = new QTextEdit(this);
QTextEdit * asmText = new QTextEdit(this);
QTextEdit * pointsText = new QTextEdit(this);
QTextEdit * programText = new QTextEdit(this);
QTextEdit * confText = new QTextEdit(this);
outText->setFrameStyle(QFrame::NoFrame);
asmText->setFrameStyle(QFrame::NoFrame);
pointsText->setFrameStyle(QFrame::NoFrame);
programText->setFrameStyle(QFrame::NoFrame);
confText->setFrameStyle(QFrame::NoFrame);
outText->setReadOnly(true);
asmText->setReadOnly(true);
pointsText->setReadOnly(true);
programText->setReadOnly(true);
confText->setReadOnly(true);
topLayout->addWidget(tabs);
tabs->addTab(outText, "Output");
tabs->addTab(asmText, "Assembly");
tabs->addTab(pointsText, "Patterns Memory");
tabs->addTab(programText, "Program");
tabs->addTab(confText, "Configuration");
loadFile(outputPath + "/assembly.asm", asmText);
loadInfo("-mem", outputPath + "/patterns.mif", pointsText);
loadInfo("-pro", outputPath + "/program.mif", programText);
outText->setPlainText(result);
QString appdir = QApplication::applicationDirPath();
loadFile(appdir + "/configuration.ini", confText);
setLayout(topLayout);
setWindowTitle(tr("Estimo C Output"));
}
示例4: file
ConfigPage::ConfigPage(Context *context) : context(context)
{
QTextEdit *text = new QTextEdit(this);
text->setAutoFillBackground(false);
#ifdef Q_OS_MAC
text->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
text->setFrameStyle(QFrame::NoFrame);
text->setContentsMargins(0,0,0,0);
QFile file(":gcconfig.pri");
file.open(QFile::ReadOnly);
QTextStream stream(&file);
QString contents = stream.readAll();
file.close();
text->setText(contents);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(0,0,0,0);
mainLayout->addWidget(text);
setLayout(mainLayout);
}
示例5: QWidget
TrayNotificationWidget::TrayNotificationWidget(QPixmap pixmapIcon, QString headerText, QString messageText) : QWidget(0)
{
setWindowFlags(
#ifdef Q_OS_MAC
Qt::SubWindow | // This type flag is the second point
#else
Qt::Tool |
#endif
Qt::FramelessWindowHint |
Qt::WindowSystemMenuHint |
Qt::WindowStaysOnTopHint
);
setAttribute(Qt::WA_NoSystemBackground, true);
// set the parent widget's background to translucent
setAttribute(Qt::WA_TranslucentBackground, true);
//setAttribute(Qt::WA_ShowWithoutActivating, true);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
// create a display widget for displaying child widgets
QWidget* displayWidget = new QWidget;
displayWidget->setStyleSheet(".QWidget { background-color: rgba(0, 0, 0, 75%); border-width: 1px; border-style: solid; border-radius: 10px; border-color: #555555; } .QWidget:hover { background-color: rgba(68, 68, 68, 75%); border-width: 2px; border-style: solid; border-radius: 10px; border-color: #ffffff; }");
QLabel* icon = new QLabel;
icon->setPixmap(pixmapIcon);
icon->setMaximumSize(32, 32);
QLabel* header = new QLabel;
header->setMaximumSize(250, 50);
header->setWordWrap(true);
header->setText(headerText);
header->setStyleSheet("QLabel { color: #ffffff; font-weight: bold; font-size: 12px; }");
QTextEdit *message = new QTextEdit;
message->setReadOnly(true);
message->setFrameStyle(QFrame::NoFrame);
message->setLineWrapMode(QTextEdit::WidgetWidth);
message->setWordWrapMode(QTextOption::WrapAnywhere);
QPalette pal = palette();
pal.setColor(QPalette::Base, Qt::transparent);
message->setPalette(pal);
message->setStyleSheet("QTextEdit { color: #ffffff; font-size: 10px; }");
message->setText(messageText);
message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
QVBoxLayout* vl = new QVBoxLayout;
vl->addWidget(header);
vl->addWidget(message);
QHBoxLayout* displayMainLayout = new QHBoxLayout;
displayMainLayout->addWidget(icon);
displayMainLayout->addLayout(vl);
displayWidget->setLayout(displayMainLayout);
QHBoxLayout* containerLayout = new QHBoxLayout;
containerLayout->addWidget(displayWidget);
setLayout(containerLayout);
show();
setMinimumHeight((int)(message->document()->size().height() *1.5 + header->height() +70));
timeout = new QTimer(this);
connect(timeout, SIGNAL(timeout()), this, SLOT(fadeOut()));
timeout->start(3000);
}
示例6: if
//.........这里部分代码省略.........
if (messagecount == 1)
lineEdit->setText(tr(messages[0]));
height = lineEdit->font().pointSize() + 4;
if (height < 0)
height = lineEdit->font().pixelSize() + 4;
if (height < 0)
height = lineEdit->heightForWidth(width) + 4;
lineEdit->setSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::Fixed);
lineEdit->setMinimumSize(QSize(width, height));
lineEdit->setGeometry(QRect(0, 0, width, height));
vboxLayout1->addWidget(lineEdit);
}
else {
QFont fixed("monospace");
fixed.setStyleHint(QFont::TypeWriter);
textEdit = new QTextEdit(this);
textEdit->setFont(fixed);
textEdit->setLineWrapMode(QTextEdit::FixedColumnWidth);
textEdit->setLineWrapColumnOrWidth(80);
textEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
if (nosliderflag)
textEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
else if (usesliderflag)
textEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
else
textEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
for (int m = 0; m < messagecount; m++)
textEdit->append(tr(messages[m]));
if (inputflag)
textEdit->setReadOnly(false);
else {
textEdit->setLineWidth(1);
textEdit->setFrameStyle(noframeflag ? QFrame::NoFrame :
QFrame::Box | QFrame::Sunken);
textEdit->setReadOnly(true);
}
if (usesliderflag)
height = DEFAULT_EDIT_HEIGHT;
else {
height = textEdit->font().pointSize() + 4;
if (height < 0)
height = textEdit->font().pixelSize() + 4;
if (height < 0)
height = textEdit->heightForWidth(width) + 4;
height *= messagecount;
}
textEdit->setMinimumSize(QSize(width, height));
textEdit->setSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::MinimumExpanding);
textEdit->moveCursor(QTextCursor::Start);
textEdit->ensureCursorVisible();
vboxLayout1->addWidget(textEdit);
}
hboxLayout1 = new QHBoxLayout();
hboxLayout1->setSpacing(6);
hboxLayout1->setMargin(0);
spacerItem2 = new QSpacerItem(40, 20, QSizePolicy::Expanding,
QSizePolicy::Minimum);
hboxLayout1->addItem(spacerItem2);
for (int i = 0; i < buttoncount; i++) {
QueryButton *button = new QueryButton(printflag, this);
button->setMinimumSize(QSize(72, 32));
button->setDefault(buttons[i] == defaultbutton);
button->setQuery(this);
button->setText(tr(buttons[i]));
button->setStatus(statusi[i]);
if (inputflag && buttons[i] == defaultbutton) {
if (textEdit)
button->setEditor(textEdit);
else if (lineEdit) {
button->setEditor(lineEdit);
if (buttons[i] == defaultbutton)
connect(lineEdit, SIGNAL(returnPressed()),
button, SLOT(click()));
}
}
connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()));
hboxLayout1->addWidget(button);
}
vboxLayout1->addLayout(hboxLayout1);
hboxLayout->addLayout(vboxLayout1);
gridLayout->addLayout(hboxLayout, 0, 0, 1, 1);
gridLayout->setSizeConstraint(QLayout::SetFixedSize);
if (inputflag && messagecount <= 1)
resize(QSize(320, 83));
else
resize(QSize(320, 132));
if (timeout)
startTimer(timeout * 1000);
if (exclusiveflag)
setWindowModality(Qt::WindowModal);
}