我在网页的左侧有一个div位置fixed,包含菜单和导航链接.它没有从css设置的高度,内容决定高度,宽度是固定的.问题是如果内容太多,div则会大于窗口的高度,部分内容将不可见.(滚动窗口没有帮助,因为位置是fixed并且div不会滚动.)
我试图设置,overflow-y:auto;但这也没有帮助,div似乎没有注意到它的一部分是在窗口之外.
如果需要,如果div挂出窗口,我该如何才能使其内容可滚动?
Qt示例项目中C++/QML源中的//! [n](n= 0,1,2 ......)标记是什么意思?
例如:
//! [0]
GLWidget::GLWidget(Helper *helper, QWidget *parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent), helper(helper)
{
elapsed = 0;
setFixedSize(840, 400);
setAutoFillBackground(false);
}
//! [0]
//! [1]
void GLWidget::animate()
{
elapsed = (elapsed + qobject_cast<QTimer*>(sender())->interval()) % 1000;
repaint();
}
//! [1]
//! [2]
void GLWidget::paintEvent(QPaintEvent *event)
{
QPainter painter;
painter.begin(this);
painter.setRenderHint(QPainter::Antialiasing);
helper->paint(&painter, event, elapsed);
painter.end();
}
//! [2]
Run Code Online (Sandbox Code Playgroud) 我有一个Safari浏览器插件,在其中,我想打开一个NSWindow来显示版权说明.当对话框中的Ok按钮关闭对话框的窗口,并且工作正常时,当我点击左上角的红色关闭窗口"x"时,它也会关闭窗口,但它是父窗口(整个浏览器选项卡,我让插件运行),仍然被禁用,好像仍然在某处打开模态窗口.
我甚至试图将一个新的选择器附加到窗口关闭通知,该选项运行与Ok按钮相同的代码,但是,它仍然无法正常工作.
以下是代码的相关部分:
- (void) closeBox
{
// called when the Ok button pressed
[NSApp abortModal];
}
- (void)closeClicked:(NSNotification *)notification
{
// called when the close window 'x' button pressed
NSLog(@"Closed");
[NSApp abortModal];
}
- (void) openBox
{
NSRect frame = NSMakeRect(0, 0, 300, 250);
mwin = [[[NSWindow alloc] initWithContentRect:frame
styleMask:NSClosableWindowMask |NSTitledWindowMask
backing:NSBackingStoreBuffered
defer:NO] autorelease];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(closeClicked:)
name:NSWindowWillCloseNotification
object:mwin];
NSButton * bn;
bn = [[[NSButton alloc] initWithFrame:NSMakeRect(10, 10, 100, 20) ] autorelease];
[bn setButtonType:NSMomentaryPushInButton];
[bn setTitle:@"Ok"];
[bn setTarget:self]; …Run Code Online (Sandbox Code Playgroud) 我想了解一下以下情况:
>>> class Test:
... a = 1
...
>>> x = Test()
>>> x.__dict__
{}
>>> x.a
1
>>> x.__dict__
{}
>>> x.a = 1
>>> x.__dict__
{'a': 1}
Run Code Online (Sandbox Code Playgroud)
属性在开始时存储在哪里a以及它如何在__dict__赋值后才可见?