Harini
22nd November 2013, 10:43
Hello everyone :)
I'm using Qt 4.7. I want a main window of size 272x380 with a line edit widget in it of completely black color(total window and lineedit). But here i'm unable to change the color of line edit border :confused:
Here is my code and screen shot attached....As displayed in the screenshot I need that red shaded border also black. I tried different types of code but i din't get it.Can any one please help me regarding this issue?? :confused: :confused:
#include <QtGui/QApplication>
#include "mainwindow.h"
#include <QLineEdit>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QLineEdit *LineEdit = new QLineEdit;
LineEdit->setStyleSheet("border: black");
//LineEdit->setStyleSheet("border: 1px solid black");
//LineEdit->setStyleSheet("QLineEdit{background: black;}");
// ("QLineEdit { background-color : rgb(45, 45, 45); }");
//LineEdit>setStyleSheet("QLineEdit{background: black;}");
QMainWindow window;
window.setWindowFlags(Qt::WindowTitleHint | Qt::FramelessWindowHint);
window.setWindowTitle(" ");
window.setFixedSize(272,480);
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent, Qt::FramelessWindowHint),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setStyleSheet("background-color:rgb(13, 13, 13);");
// this->setStyleSheet("QLineEdit{foregroundRole-color : rgb(244, 244, 244); }");
//this->setStyleSheet("QLineEdit{border: black;}");
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
protected:
void changeEvent(QEvent *e);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
I'm using Qt 4.7. I want a main window of size 272x380 with a line edit widget in it of completely black color(total window and lineedit). But here i'm unable to change the color of line edit border :confused:
Here is my code and screen shot attached....As displayed in the screenshot I need that red shaded border also black. I tried different types of code but i din't get it.Can any one please help me regarding this issue?? :confused: :confused:
#include <QtGui/QApplication>
#include "mainwindow.h"
#include <QLineEdit>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QLineEdit *LineEdit = new QLineEdit;
LineEdit->setStyleSheet("border: black");
//LineEdit->setStyleSheet("border: 1px solid black");
//LineEdit->setStyleSheet("QLineEdit{background: black;}");
// ("QLineEdit { background-color : rgb(45, 45, 45); }");
//LineEdit>setStyleSheet("QLineEdit{background: black;}");
QMainWindow window;
window.setWindowFlags(Qt::WindowTitleHint | Qt::FramelessWindowHint);
window.setWindowTitle(" ");
window.setFixedSize(272,480);
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent, Qt::FramelessWindowHint),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setStyleSheet("background-color:rgb(13, 13, 13);");
// this->setStyleSheet("QLineEdit{foregroundRole-color : rgb(244, 244, 244); }");
//this->setStyleSheet("QLineEdit{border: black;}");
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
protected:
void changeEvent(QEvent *e);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H