I am an amatuer with JOGL and SWT. I got a problem while try show some SWT Widgets over the GLCanvas using AbsoluteLayout.
composite = new Composite(parent, SWT.NONE);
composite.setLayout(null);
Button button = new Button(composite, SWT.NONE);
button.setText("New Button");
button.setBounds(172, 145, 94, 28);
glcanvas = GLCanvas.create(composite, SWT.NO_BACKGROUND, null, null, null);
I thought that the button should be on top of GLCanvas but it is always behind the GLCanvas. Am i doing something wrong ? Please help me, thank you very much.
Have you tried:
composite = new Composite(parent, SWT.NONE);
composite.setLayout(null);
glcanvas = GLCanvas.create(composite, SWT.NO_BACKGROUND, null, null, null);
Button button = new Button(composite, SWT.NONE);
button.setText("New Button");
button.setBounds(172, 145, 94, 28);
(Moving the glcanvas = GLCanvas... upwards to before creating the button)
Unless I'm missing something you're adding the button and then the canvas on top of it.
Currently, there is no solution for this problem. For more details, this problem only happens on MacOS , i have tested under Windows 8 x64 and it ok no thing is overlayed. Here is the link to the discusion on the official forum
http://forum.jogamp.org/How-to-overlay-SWT-Widgets-over-GLCanvas-td4029507.html
Related
I am using Qt Creator 4.0.2 Based on Qt 5.7.0 (GCC 4.9.1 20140922 (Red Hat 4.9.1-10), 64 bit).
I am displaying an image on my widget and placing QButtons and QLabels on top of it.
It looks something like this:
I want to make the button semi-transparent. There isn't any property for it. I tried the answer given on another thread as:
ui->button->setStyleSheet("background-color: rgba(255, 255, 255, 50);");
But it didn't work for me. I also tried setStyleSheet("background:transparent;")
But it didn't work.
Please suggest a way of doing it.
setting the bg color to "transparent" is not enough, you need to set the "border-style: outset;" and nothing else in the main window/widget...
ui->pushButton_7->setStyleSheet("background-color: transparent; style: outset;");
then:
do:
ui->pushButton_7->setStyleSheet("background-color: #FF0011");
auto qgoEffect = new QGraphicsOpacityEffect(this);
qgoEffect->setOpacity(0.15);
ui->pushButton_7->setGraphicsEffect(qgoEffect);
ui->pushButton_7->setAutoFillBackground(true);
Setting a transparent background to the button is not enough: you have to set some attributes to your main widget in order to ask the window manager to let the button to manage its own background.
QWidget* w = new QWidget();
QPushButton* btn = new QPushButton("Click me", w);
btn->setStyleSheet("background-color: rgba(255, 255, 255, 50);");
w->setWindowFlags(Qt::FramelessWindowHint); // Do not display the window frame
w->setAttribute( Qt::WA_TranslucentBackground, true ); // Do not display the default background
w->show();
I'm drawing gtk dialogue box as shown below :
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(webkitBrowserWindow),
flags,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"%s",message_data->str.str );
//Setting min-width and min-height for popup.
if(gtkWebView){
gint minWidth = 0, minHeight = 0;
gtk_widget_get_size_request (GTK_WIDGET(gtkWebView), &minWidth, &minHeight);
gtk_widget_set_size_request (GTK_WIDGET(dialog), minWidth, minHeight);
}
gtk_widget_show(dialog);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
popupInProgress=false;
But i would like to change the language of text content and "OK" button as per system language, i have written an inbuilt function for language change which returns translated string, using which i'm able to update the language of text content of the dialogue box, but i'm not sure how to change the language of "OK" button.
Please suggest.
TIA.
Regards,
Lakshmikanth .G
I am trying to add dynamic tooltips to my mfc application. I am able to display tooltips using CToolTipCtrl with static text. But when I change the text to LPSTR_TEXTCALLBACK I don't get a TTN_GETDISPINFO notification to set the text and nothing gets displayed anymore.
I created a new MFC project from scratch and there it works. So something must be different in my application. But I am not able to find out, what I do wrong or where I should start looking.
What could be possible reasons for this behaviour? Is it possible that the notifications diverted to somewhere else?
I added the handler like this:
ON_NOTIFY(TTN_GETDISPINFO, NULL, OnToolTipNotify)
void CChildView::OnToolTipNotify(NMHDR* pNMHDR, LRESULT* pResult)
{
TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
wsprintf(pTTTW->szText,L"Hello World!");
}
The tooltip was added in the OnCreate function using the CMyToolTipCtrl class from Jeff Prosise MFC book:
CToolTipCtrl* tooltip = new CToolTipCtrl;
tooltip->Create(this, TTS_ALWAYSTIP);
TOOLINFO ti;
ti.cbSize = sizeof (TOOLINFO);
ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
ti.hwnd = this->GetSafeHwnd ();
ti.uId = (UINT) tooltip->GetSafeHwnd ();
ti.hinst = AfxGetInstanceHandle ();
ti.lpszText = (LPTSTR) LPSTR_TEXTCALLBACK;
SendMessage (TTM_ADDTOOL, 0, (LPARAM) &ti);
If I change the second to last line to
ti.lpszText = (LPTSTR) L"Hello World!";
the tooltip gets displayed in my application, too.
It might be a problem of your project setting.
What kind of project is it? Unicode or MBCS.
If it is an MBCS message you might miss the notification because the tooltip is an unicode window and sends TTN_GETDISPINFOW!
So best practice for me is to implement always both notifications TTN_GETDISPINFOW and TTN_GETDISPINFOA.
You might check this with Spy++
I would like to be able to draw a file line using native Windows API (LineTo) like the one that TreeView uses to connect nodes to each other. But using RS_DOT to create the brush (::CreatePen(PS_DOT, 0, RGB(200, 200, 200))), produces a different kind of line. Does anyone know how I can draw such a line?
Creating a true dotted pen
LOGBRUSH LogBrush;
LogBrush.lbColor = c_colorGridLine;
LogBrush.lbStyle = PS_SOLID;
penDotted.CreatePen( PS_COSMETIC | PS_ALTERNATE , 1, &LogBrush, 0, NULL );
I'm creating an automated test application using QTest Library. I'm able to simulate key presses on the application except when it gets to a window having QDialogButtonBox (Save, and Cancel).
Here's my sample code:
std::auto_ptr<MainForm> myForm( new MainForm( 3, 3 ));
myForm->show();
QTest::keyPress(myForm.get(), Qt::Key_0, NULL, 1000);
QTest::keyRelease(myForm.get(), Qt::Key_0, NULL, 100);
QWidget *pWin = QApplication::activeWindow();
QCOMPARE(QString(pWin->objectName()), QString("MyMainForm"));
now when it gets to the next window, it has several controls where the input focus is on a text edit control. When I press Enter, it presses the "Save" button. So theoretically, if I should pass Qt::Enter to the Form, it should press the "Save" button as well. However when I try to pass a keyPress:
QTest::keyPress(pWin, Qt::Key_Enter, 1000);
nothing happens... what do you think is going on? I've tried setFocus() to the button but nothing happens as well...
in QDialogButtonBox you may get needed button with
QPushButton * QDialogButtonBox::button ( StandardButton which )
and then call it's SetFocus method.
If you can't access QDialogButtonBox directly, you may get it with
QList<T> QObject::findChildren ( const QString & name = QString() )
or even get buttons themself with this method...
I think you need to send the key event to the button or line edit instead of the parent window.
QWidget *pWin = QApplication::activeWindow();
QTest::keyPress(pwin, Qt::Key_0, NULL, 1000);
QTest::keyRelease(pwin, Qt::Key_0, NULL, 100);
I have to say that the documentation is not clear, but it works for me this way.